%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home2/rezakur1/muakita.rezakurnia.com/Mua-Kita-Web/src/components/views/
Upload File :
Create Path :
Current File : //home2/rezakur1/muakita.rezakurnia.com/Mua-Kita-Web/src/components/views/CreateReservationView.tsx

import React, { useState } from 'react';
import { 
  CalendarDays, User, Sparkles, Phone, Instagram, MapPin, 
  Plus, Edit2, Trash2, Camera, Image as ImageIcon, ChevronRight, ChevronLeft,
  Check, ExternalLink, Bot, CheckCircle2
} from 'lucide-react';
import { Reservation } from '../../types';

interface CreateReservationViewProps {
  onSave?: (newRes: Reservation) => void;
  onCancel?: () => void;
  triggerToast?: (msg: string) => void;
}

export const CreateReservationView: React.FC<CreateReservationViewProps> = ({
  onSave,
  onCancel,
  triggerToast = (_msg: string) => {}
}) => {
  // Step State (1 to 5)
  const [currentStep, setCurrentStep] = useState(1);

  // Step 1: Data Client
  const [clientName, setClientName] = useState('Reza Amelia');
  const [clientPhone, setClientPhone] = useState('0812 3456 7890');
  const [clientIg, setClientIg] = useState('@reza.amelia');
  const [clientSource, setClientSource] = useState('Instagram');
  const [allowTag, setAllowTag] = useState<'ya' | 'tidak'>('ya');

  // Step 2: Layanan & Orang
  const [addonSoftlens, setAddonSoftlens] = useState(false);
  const [addonTouchup, setAddonTouchup] = useState(false);
  const [addonRetouch, setAddonRetouch] = useState(false);
  const [noteLayanan, setNoteLayanan] = useState('');

  // Persons list
  const [persons, setPersons] = useState([
    { id: 1, role: 'Bride (Client)', makeup: true, hairdo: true, hijab: true },
    { id: 2, role: 'Mother', makeup: true, hairdo: true, hijab: false },
  ]);
  const [selectedRoleToAdd, setSelectedRoleToAdd] = useState('Maid / Sister / Others');

  // Step 3: Detail Acara
  const [eventDate, setEventDate] = useState('2026-07-26');
  const [eventTime, setEventTime] = useState('19:51');
  const [locationLink, setLocationLink] = useState('The Westin Jakarta, Jl. H.R. Rasuna Said Kaw. C-22A, Kuningan, Jakarta Selatan');
  const [eventNote, setEventNote] = useState('');

  // Step 4: Pembayaran
  const [subtotal] = useState(1500000);
  const [transportCost] = useState(75000);
  const [otherCost] = useState(50000);
  const [discount] = useState(100000);
  const [dpAmount, setDpAmount] = useState('500.000');
  const [noDp, setNoDp] = useState(false);
  const [paymentStatus, setPaymentStatus] = useState<'Belum Bayar' | 'DP Masuk' | 'Lunas'>('DP Masuk');

  const grandTotal = subtotal + transportCost + otherCost - discount;
  const numericDp = noDp ? 0 : parseInt(dpAmount.replace(/\D/g, '') || '0', 10);
  const remainingPayment = Math.max(0, grandTotal - numericDp);

  const stepsList = [
    { id: 1, label: 'Client', subtitle: 'Data Pemesan' },
    { id: 2, label: 'Layanan', subtitle: 'Paket & Additional Person' },
    { id: 3, label: 'Acara', subtitle: 'Waktu & Lokasi Google Maps' },
    { id: 4, label: 'Pembayaran', subtitle: 'Rincian & DP' },
    { id: 5, label: 'Konfirmasi', subtitle: 'Review & Finish' },
  ];

  const handleAddPerson = () => {
    setPersons([
      ...persons,
      { id: Date.now(), role: selectedRoleToAdd, makeup: true, hairdo: true, hijab: false }
    ]);
    triggerToast(`Berhasil menambah orang: ${selectedRoleToAdd}`);
  };

  const handleRemovePerson = (id: number) => {
    setPersons(persons.filter(p => p.id !== id));
  };

  const handleNextStep = () => {
    if (currentStep === 1 && !clientName) {
      triggerToast('Mohon isi Nama Client terlebih dahulu');
      return;
    }
    if (currentStep < 5) {
      setCurrentStep(currentStep + 1);
    }
  };

  const handlePrevStep = () => {
    if (currentStep > 1) {
      setCurrentStep(currentStep - 1);
    }
  };

  const handleSubmit = (actionType: 'draft' | 'invoice' | 'final') => {
    if (!clientName) {
      triggerToast('Mohon isi Nama Client');
      setCurrentStep(1);
      return;
    }

    const newRes: Reservation = {
      id: `r${Date.now()}`,
      name: clientName,
      service: 'Wedding Makeup Package',
      date: eventDate,
      status: actionType === 'final' ? 'Dikonfirmasi' : 'Draft',
      payment: paymentStatus === 'Lunas' ? 'Lunas' : paymentStatus === 'DP Masuk' ? 'DP 50%' : 'Belum Bayar'
    };

    if (onSave) onSave(newRes);

    if (actionType === 'draft') {
      triggerToast('Reservasi berhasil disimpan sebagai Draft');
    } else if (actionType === 'invoice') {
      triggerToast('Invoice berhasil dibuat & dikirim ke WhatsApp Client!');
    } else {
      triggerToast('Reservasi baru berhasil dikonfirmasi & dibuat!');
    }
  };

  return (
    <div className="space-y-4 animate-in fade-in duration-200 max-w-6xl mx-auto">
      
      {/* Top Header & Stepper Tabs Navigation */}
      <div className="bg-white p-4 rounded-2xl border border-slate-200/80 shadow-2xs space-y-4">
        
        {/* Title Bar */}
        <div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pb-3 border-b border-slate-100">
          <div>
            <div className="flex items-center gap-2">
              <span className="w-8 h-8 rounded-xl bg-pink-50 text-[#EC167F] font-black text-sm flex items-center justify-center">
                <CalendarDays className="w-4 h-4" />
              </span>
              <div>
                <h1 className="text-base font-extrabold text-slate-900">Create Reservasi / Booking</h1>
                <p className="text-xs text-slate-500">Buat reservasi baru untuk client Anda secara bertahap (per tab)</p>
              </div>
            </div>
          </div>
        </div>

        {/* Stepper Tabs Bar (Step 1-5) */}
        <div className="grid grid-cols-2 sm:grid-cols-5 gap-2 pt-1">
          {stepsList.map((st) => {
            const isActive = currentStep === st.id;
            const isCompleted = currentStep > st.id;

            return (
              <button
                key={st.id}
                type="button"
                onClick={() => setCurrentStep(st.id)}
                className={`p-2.5 rounded-xl border text-left transition-all cursor-pointer flex items-center gap-2.5 ${
                  isActive
                    ? 'bg-pink-50/80 border-[#EC167F] text-[#EC167F] shadow-2xs'
                    : isCompleted
                    ? 'bg-emerald-50/50 border-emerald-200 text-emerald-800'
                    : 'bg-slate-50 border-slate-200 text-slate-500 hover:bg-slate-100'
                }`}
              >
                <span className={`w-7 h-7 rounded-full text-xs font-black flex items-center justify-center shrink-0 ${
                  isActive
                    ? 'bg-[#EC167F] text-white shadow-xs'
                    : isCompleted
                    ? 'bg-emerald-600 text-white'
                    : 'bg-slate-200 text-slate-600'
                }`}>
                  {isCompleted ? <Check className="w-4 h-4 stroke-[3]" /> : st.id}
                </span>
                <div className="min-w-0">
                  <span className="text-xs font-extrabold block truncate">{st.label}</span>
                  <span className="text-[10px] opacity-70 block truncate font-medium">{st.subtitle}</span>
                </div>
              </button>
            );
          })}
        </div>

      </div>

      {/* STEP-BY-STEP TAB CONTENT VIEWS */}
      <div>

        {/* STEP 1: DATA CLIENT */}
          {currentStep === 1 && (
            <div className="grid grid-cols-1 md:grid-cols-3 gap-4 items-start animate-in fade-in zoom-in-98 duration-200">
              
              {/* Main Client Form */}
              <div className="md:col-span-2 bg-white rounded-2xl p-5 border border-slate-200/80 shadow-2xs space-y-4">
                <div className="flex items-center gap-2 pb-3 border-b border-slate-100">
                  <User className="w-5 h-5 text-[#EC167F]" />
                  <div>
                    <h2 className="text-sm font-extrabold text-slate-900">1. Data Client Pemesan</h2>
                    <p className="text-xs text-slate-500">Lengkapi profil dan nomor kontak client</p>
                  </div>
                </div>

                <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
                  <div>
                    <label className="block text-xs font-bold text-slate-700 mb-1">
                      Nama Client <span className="text-rose-500">*</span>
                    </label>
                    <input 
                      type="text" 
                      value={clientName}
                      onChange={(e) => setClientName(e.target.value)}
                      className="w-full px-3.5 py-2.5 bg-slate-50 border border-slate-200 rounded-xl text-xs font-medium focus:bg-white focus:outline-none focus:ring-2 focus:ring-pink-500/20"
                      placeholder="Masukkan nama client"
                    />
                  </div>

                  <div>
                    <label className="block text-xs font-bold text-slate-700 mb-1">
                      No. WhatsApp <span className="text-rose-500">*</span>
                    </label>
                    <div className="relative">
                      <div className="absolute left-3.5 top-3 text-emerald-500">
                        <Phone className="w-4 h-4" />
                      </div>
                      <input 
                        type="text" 
                        value={clientPhone}
                        onChange={(e) => setClientPhone(e.target.value)}
                        className="w-full pl-10 pr-3.5 py-2.5 bg-slate-50 border border-slate-200 rounded-xl text-xs font-medium focus:bg-white focus:outline-none focus:ring-2 focus:ring-pink-500/20"
                        placeholder="0812xxxx"
                      />
                    </div>
                  </div>

                  <div>
                    <label className="block text-xs font-bold text-slate-700 mb-1">
                      Instagram <span className="text-slate-400 font-normal">(opsional)</span>
                    </label>
                    <div className="relative">
                      <div className="absolute left-3.5 top-3 text-pink-500">
                        <Instagram className="w-4 h-4" />
                      </div>
                      <input 
                        type="text" 
                        value={clientIg}
                        onChange={(e) => setClientIg(e.target.value)}
                        className="w-full pl-10 pr-3.5 py-2.5 bg-slate-50 border border-slate-200 rounded-xl text-xs font-medium focus:bg-white focus:outline-none focus:ring-2 focus:ring-pink-500/20"
                        placeholder="@username"
                      />
                    </div>
                  </div>

                  <div>
                    <label className="block text-xs font-bold text-slate-700 mb-1">Sumber Client</label>
                    <select 
                      value={clientSource}
                      onChange={(e) => setClientSource(e.target.value)}
                      className="w-full px-3.5 py-2.5 bg-slate-50 border border-slate-200 rounded-xl text-xs font-medium focus:bg-white focus:outline-none focus:ring-2 focus:ring-pink-500/20 cursor-pointer"
                    >
                      <option value="Instagram">Instagram</option>
                      <option value="TikTok">TikTok</option>
                      <option value="Rekomendasi Teman">Rekomendasi Teman</option>
                      <option value="Google Search">Google Search</option>
                      <option value="Bridestory">Bridestory</option>
                    </select>
                  </div>
                </div>

                <div>
                  <label className="block text-xs font-bold text-slate-700 mb-2">
                    Boleh di-posting & di-tag di Instagram MUA?
                  </label>
                  <div className="flex items-center gap-6 text-xs font-semibold text-slate-700 bg-slate-50 p-3 rounded-xl border border-slate-200/80">
                    <label className="flex items-center gap-2 cursor-pointer">
                      <input 
                        type="radio" 
                        name="allowTag" 
                        checked={allowTag === 'ya'} 
                        onChange={() => setAllowTag('ya')}
                        className="accent-[#EC167F] w-4 h-4" 
                      />
                      <span>Ya, boleh diposting</span>
                    </label>
                    <label className="flex items-center gap-2 cursor-pointer">
                      <input 
                        type="radio" 
                        name="allowTag" 
                        checked={allowTag === 'tidak'} 
                        onChange={() => setAllowTag('tidak')}
                        className="accent-[#EC167F] w-4 h-4" 
                      />
                      <span>Tidak (Private)</span>
                    </label>
                  </div>
                </div>

              </div>

              {/* Side Summary & Loyalty Badge */}
              <div className="space-y-4">
                <div className="bg-white border border-slate-200/80 rounded-2xl p-4 shadow-2xs space-y-3">
                  <div className="flex items-center justify-between pb-2 border-b border-slate-100">
                    <span className="text-xs font-extrabold text-slate-800">Riwayat Client CRM</span>
                    <div className="flex gap-1">
                      <span className="px-2 py-0.5 bg-emerald-100 text-emerald-800 text-[10px] font-black rounded-md">Repeat Client</span>
                      <span className="px-2 py-0.5 bg-purple-100 text-purple-800 text-[10px] font-black rounded-md">VIP</span>
                    </div>
                  </div>

                  <div className="space-y-2 text-xs text-slate-600 font-medium">
                    <div className="flex justify-between">
                      <span className="text-slate-400">Total Reservasi</span>
                      <span className="font-extrabold text-slate-800">8 kali</span>
                    </div>
                    <div className="flex justify-between">
                      <span className="text-slate-400">Terakhir Booking</span>
                      <span className="font-bold text-slate-700">2 bulan lalu</span>
                    </div>
                    <div className="flex justify-between">
                      <span className="text-slate-400">Total Belanja</span>
                      <span className="font-extrabold text-[#EC167F]">Rp 18.250.000</span>
                    </div>
                    <div className="flex justify-between items-center">
                      <span className="text-slate-400">Rating Client</span>
                      <div className="flex items-center gap-1 font-bold text-amber-500">
                        <span>★★★★★</span>
                        <span className="text-slate-800">4.9</span>
                      </div>
                    </div>
                  </div>
                </div>

                <div className="bg-purple-50/80 border border-purple-200/80 rounded-2xl p-3.5 text-xs text-purple-900 flex items-start gap-2.5">
                  <Sparkles className="w-4 h-4 text-purple-600 shrink-0 mt-0.5" />
                  <div>
                    <span className="font-extrabold block text-purple-950 mb-0.5">Catatan CRM</span>
                    <p className="text-purple-800 leading-relaxed text-[11px]">
                      Client ini terakhir booking pada 15 Mei 2025 (Wedding Jakarta). Menyukai look makeup glowing natural.
                    </p>
                  </div>
                </div>
              </div>

            </div>
          )}

          {/* STEP 2: LAYANAN & ORANG */}
          {currentStep === 2 && (
            <div className="grid grid-cols-1 md:grid-cols-3 gap-4 items-start animate-in fade-in zoom-in-98 duration-200">
              
              <div className="md:col-span-2 bg-white rounded-2xl p-5 border border-slate-200/80 shadow-2xs space-y-5">
                <div className="flex items-center justify-between pb-3 border-b border-slate-100">
                  <div className="flex items-center gap-2">
                    <Sparkles className="w-5 h-5 text-[#EC167F]" />
                    <div>
                      <h2 className="text-sm font-extrabold text-slate-900">2. Layanan & Additional Persons</h2>
                      <p className="text-xs text-slate-500">Pilih paket utama dan orang tambahan</p>
                    </div>
                  </div>

                  <div className="flex gap-2">
                    <button 
                      type="button"
                      onClick={() => triggerToast('Membuka katalog paket lengkap')}
                      className="py-1.5 px-3 bg-pink-50 hover:bg-pink-100 text-[#EC167F] rounded-xl text-xs font-bold border border-pink-200 transition-colors flex items-center gap-1 cursor-pointer"
                    >
                      <Plus className="w-3.5 h-3.5" />
                      <span>Ganti Paket</span>
                    </button>
                  </div>
                </div>

                {/* Selected Main Package Card */}
                <div className="bg-slate-50 border border-slate-200 rounded-2xl p-4 space-y-3">
                  <div className="flex items-start gap-3">
                    <img 
                      src="https://images.unsplash.com/photo-1487412720507-e7ab37603c6f?auto=format&fit=crop&q=80&w=200" 
                      alt="Wedding Makeup" 
                      referrerPolicy="no-referrer"
                      className="w-16 h-16 rounded-xl object-cover border border-slate-200 shrink-0"
                    />
                    <div className="flex-1 min-w-0">
                      <div className="flex items-center justify-between">
                        <h3 className="text-sm font-black text-slate-900">Wedding Makeup Package</h3>
                        <span className="text-sm font-black text-[#EC167F]">Rp1.500.000</span>
                      </div>
                      <p className="text-xs text-slate-500 font-medium mt-0.5">Paket Wedding Premium Complete Look</p>

                      <div className="flex items-center gap-4 text-xs text-slate-600 font-bold mt-2">
                        <span>Orang: <strong className="text-slate-900">1</strong></span>
                        <span>Durasi: <strong className="text-slate-900">2 Jam</strong></span>
                      </div>
                    </div>
                  </div>

                  <div className="pt-2 border-t border-slate-200/80">
                    <p className="text-[10px] font-extrabold text-slate-400 uppercase tracking-wider mb-1.5">Layanan Termasuk Dalam Paket</p>
                    <div className="flex flex-wrap gap-1.5 text-xs font-bold text-emerald-800">
                      <span className="px-2 py-0.5 bg-emerald-50 rounded-lg border border-emerald-200">✓ Makeup</span>
                      <span className="px-2 py-0.5 bg-emerald-50 rounded-lg border border-emerald-200">✓ Hairdo</span>
                      <span className="px-2 py-0.5 bg-emerald-50 rounded-lg border border-emerald-200">✓ Hijab Styling</span>
                      <span className="px-2 py-0.5 bg-emerald-50 rounded-lg border border-emerald-200">✓ Touch Up</span>
                      <span className="px-2 py-0.5 bg-emerald-50 rounded-lg border border-emerald-200">✓ False Lashes</span>
                    </div>
                  </div>
                </div>

                {/* Additional Persons */}
                <div className="space-y-3">
                  <div className="flex items-center justify-between">
                    <h4 className="text-xs font-extrabold text-slate-800">Orang Tambahan (Family / Bridesmaid)</h4>
                    <span className="text-xs text-slate-400 font-bold">{persons.length} Orang Terdaftar</span>
                  </div>

                  <div className="space-y-2">
                    {persons.map((p, idx) => (
                      <div key={p.id} className="p-3 bg-slate-50 border border-slate-200/80 rounded-xl flex items-center justify-between text-xs">
                        <div className="flex items-center gap-3">
                          <span className="w-6 h-6 rounded-full bg-[#EC167F] text-white flex items-center justify-center text-xs font-extrabold shrink-0">
                            {idx + 1}
                          </span>
                          <div>
                            <span className="font-extrabold text-slate-900 text-xs block">{p.role}</span>
                            <div className="flex gap-2 text-[10px] font-bold text-emerald-700 mt-0.5">
                              {p.makeup && <span>✓ Makeup</span>}
                              {p.hairdo && <span>✓ Hairdo</span>}
                              {p.hijab && <span>✓ Hijab</span>}
                            </div>
                          </div>
                        </div>

                        <div className="flex items-center gap-2 text-slate-400">
                          <button onClick={() => triggerToast(`Edit ${p.role}`)} className="p-1 hover:text-slate-800 cursor-pointer">
                            <Edit2 className="w-3.5 h-3.5" />
                          </button>
                          <button onClick={() => handleRemovePerson(p.id)} className="p-1 hover:text-rose-600 cursor-pointer">
                            <Trash2 className="w-3.5 h-3.5" />
                          </button>
                        </div>
                      </div>
                    ))}
                  </div>

                  <div className="flex gap-2 pt-1">
                    <select 
                      value={selectedRoleToAdd}
                      onChange={(e) => setSelectedRoleToAdd(e.target.value)}
                      className="flex-1 px-3 py-2 bg-slate-50 border border-slate-200 rounded-xl text-xs font-medium focus:bg-white focus:outline-none"
                    >
                      <option value="Maid / Sister / Others">Maid / Sister / Others</option>
                      <option value="Bridesmaid">Bridesmaid</option>
                      <option value="Mother-in-law">Mother-in-law</option>
                      <option value="Family Member">Family Member</option>
                    </select>
                    <button 
                      type="button"
                      onClick={handleAddPerson}
                      className="px-4 py-2 bg-[#EC167F] hover:bg-[#D41270] text-white rounded-xl text-xs font-bold transition-colors cursor-pointer"
                    >
                      + Tambah Orang
                    </button>
                  </div>
                </div>

              </div>

              {/* Side Add-Ons & Note */}
              <div className="space-y-4">
                <div className="bg-white border border-slate-200/80 rounded-2xl p-4 shadow-2xs space-y-3">
                  <h4 className="text-xs font-extrabold text-slate-800">Add-On Ekstra</h4>
                  <div className="space-y-2 text-xs">
                    <button 
                      type="button"
                      onClick={() => setAddonSoftlens(!addonSoftlens)}
                      className={`w-full p-2.5 rounded-xl border text-left cursor-pointer transition-all flex items-center justify-between ${
                        addonSoftlens ? 'bg-pink-50 border-[#EC167F] text-[#EC167F]' : 'bg-slate-50 border-slate-200 text-slate-700'
                      }`}
                    >
                      <span className="font-extrabold">Softlens Import</span>
                      <span className="text-xs font-bold">Rp150.000</span>
                    </button>

                    <button 
                      type="button"
                      onClick={() => setAddonTouchup(!addonTouchup)}
                      className={`w-full p-2.5 rounded-xl border text-left cursor-pointer transition-all flex items-center justify-between ${
                        addonTouchup ? 'bg-pink-50 border-[#EC167F] text-[#EC167F]' : 'bg-slate-50 border-slate-200 text-slate-700'
                      }`}
                    >
                      <span className="font-extrabold">Touch Up Standby</span>
                      <span className="text-xs font-bold">Rp250.000</span>
                    </button>

                    <button 
                      type="button"
                      onClick={() => setAddonRetouch(!addonRetouch)}
                      className={`w-full p-2.5 rounded-xl border text-left cursor-pointer transition-all flex items-center justify-between ${
                        addonRetouch ? 'bg-pink-50 border-[#EC167F] text-[#EC167F]' : 'bg-slate-50 border-slate-200 text-slate-700'
                      }`}
                    >
                      <span className="font-extrabold">Retouch Malam</span>
                      <span className="text-xs font-bold">Rp200.000</span>
                    </button>
                  </div>
                </div>

                <div className="bg-white border border-slate-200/80 rounded-2xl p-4 shadow-2xs space-y-2">
                  <label className="block text-xs font-bold text-slate-700">Catatan Layanan</label>
                  <textarea 
                    value={noteLayanan}
                    onChange={(e) => setNoteLayanan(e.target.value)}
                    placeholder="Tulis catatan khusus gaun / warna hijab..."
                    rows={3}
                    maxLength={500}
                    className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl text-xs focus:bg-white focus:outline-none focus:ring-2 focus:ring-pink-500/20"
                  />
                  <span className="text-[10px] text-slate-400 font-mono float-right">{noteLayanan.length}/500</span>
                </div>
              </div>

            </div>
          )}

          {/* STEP 3: DETAIL ACARA */}
          {currentStep === 3 && (
            <div className="grid grid-cols-1 md:grid-cols-3 gap-4 items-start animate-in fade-in zoom-in-98 duration-200">
              
              <div className="md:col-span-2 bg-white rounded-2xl p-5 border border-slate-200/80 shadow-2xs space-y-5">
                <div className="flex items-center gap-2 pb-3 border-b border-slate-100">
                  <CalendarDays className="w-5 h-5 text-[#EC167F]" />
                  <div>
                    <h2 className="text-sm font-extrabold text-slate-900">3. Waktu & Lokasi Acara</h2>
                    <p className="text-xs text-slate-500">Tentukan tanggal, jam, dan titik lokasi pengerjaan</p>
                  </div>
                </div>

                <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
                  <div>
                    <label className="block text-xs font-bold text-slate-700 mb-1">
                      Tanggal Acara <span className="text-rose-500">*</span>
                    </label>
                    <input 
                      type="date" 
                      value={eventDate}
                      onChange={(e) => setEventDate(e.target.value)}
                      className="w-full px-3.5 py-2.5 bg-slate-50 border border-slate-200 rounded-xl text-xs font-medium focus:bg-white focus:outline-none"
                    />
                  </div>

                  <div>
                    <label className="block text-xs font-bold text-slate-700 mb-1">
                      Waktu Mulai Acara <span className="text-rose-500">*</span>
                    </label>
                    <input 
                      type="time" 
                      value={eventTime}
                      onChange={(e) => setEventTime(e.target.value)}
                      className="w-full px-3.5 py-2.5 bg-slate-50 border border-slate-200 rounded-xl text-xs font-medium focus:bg-white focus:outline-none"
                    />
                  </div>
                </div>

                <div className="bg-slate-50 border border-slate-200/80 rounded-2xl p-3.5 flex items-center justify-between text-xs">
                  <div>
                    <span className="text-slate-400 font-bold block mb-0.5">Estimasi Selesai Makeup</span>
                    <span className="font-extrabold text-slate-800 text-sm flex items-center gap-2">
                      22.36 
                      <span className="px-2 py-0.5 bg-emerald-100 text-emerald-800 text-[10px] rounded-md font-black">Kalkulasi Otomatis</span>
                    </span>
                  </div>
                  <div className="text-right">
                    <span className="text-slate-400 font-bold block mb-0.5">Durasi Total Pengerjaan</span>
                    <span className="font-extrabold text-slate-800 text-sm">2 Jam 45 Menit</span>
                  </div>
                </div>

                <div>
                  <label className="block text-xs font-bold text-slate-700 mb-1.5">
                    Lokasi Acara (Link Google Maps) <span className="text-rose-500">*</span>
                  </label>
                  <div className="flex gap-2">
                    <input 
                      type="text" 
                      value={locationLink}
                      onChange={(e) => setLocationLink(e.target.value)}
                      placeholder="Tempel link Google Maps atau nama lokasi..."
                      className="flex-1 px-3.5 py-2.5 bg-slate-50 border border-slate-200 rounded-xl text-xs focus:bg-white focus:outline-none"
                    />
                    <button 
                      type="button"
                      onClick={() => triggerToast('Link lokasi berhasil diverifikasi!')}
                      className="px-4 py-2.5 bg-pink-50 hover:bg-pink-100 text-[#EC167F] font-bold text-xs rounded-xl border border-pink-200 cursor-pointer shrink-0"
                    >
                      Tempel Link
                    </button>
                  </div>
                </div>

                {/* Google Maps Card Visual Preview */}
                <div className="bg-slate-100 border border-slate-200 rounded-2xl overflow-hidden">
                  <div className="p-4 bg-gradient-to-r from-slate-100 to-slate-200 flex items-start gap-3">
                    <MapPin className="w-5 h-5 text-rose-500 shrink-0 mt-0.5" />
                    <div className="min-w-0 flex-1">
                      <h4 className="font-extrabold text-slate-900 text-xs">The Westin Jakarta</h4>
                      <p className="text-xs text-slate-600 mt-0.5">Jl. H.R. Rasuna Said Kaw. C-22A, Kuningan, Jakarta Selatan</p>
                    </div>
                  </div>
                  <a 
                    href="https://maps.google.com" 
                    target="_blank" 
                    rel="noreferrer"
                    className="w-full py-2 bg-white hover:bg-slate-50 border-t border-slate-200 text-[#EC167F] font-bold text-xs flex items-center justify-center gap-1.5 cursor-pointer"
                  >
                    <span>Buka Google Maps</span>
                    <ExternalLink className="w-3.5 h-3.5" />
                  </a>
                </div>

              </div>

              {/* Side Location Stats */}
              <div className="space-y-4">
                <div className="bg-white border border-slate-200/80 rounded-2xl p-4 shadow-2xs space-y-3">
                  <h4 className="text-xs font-extrabold text-slate-800">Kalkulator Ongkos Kirim Tim MUA</h4>
                  <div className="grid grid-cols-3 gap-2 text-center text-xs">
                    <div className="bg-slate-50 p-2 rounded-xl border border-slate-200/80">
                      <span className="text-slate-400 block font-bold text-[10px]">Jarak</span>
                      <span className="font-extrabold text-slate-800 text-xs">12 km</span>
                    </div>
                    <div className="bg-slate-50 p-2 rounded-xl border border-slate-200/80">
                      <span className="text-slate-400 block font-bold text-[10px]">Estimasi Waktu</span>
                      <span className="font-extrabold text-slate-800 text-xs">35 mnt</span>
                    </div>
                    <div className="bg-slate-50 p-2 rounded-xl border border-slate-200/80">
                      <span className="text-slate-400 block font-bold text-[10px]">Transport</span>
                      <span className="font-extrabold text-emerald-600 text-xs">Rp75.000</span>
                    </div>
                  </div>
                </div>

                <div className="bg-white border border-slate-200/80 rounded-2xl p-4 shadow-2xs space-y-2">
                  <label className="block text-xs font-bold text-slate-700">Catatan Lokasi / Ruangan</label>
                  <textarea 
                    value={eventNote}
                    onChange={(e) => setEventNote(e.target.value)}
                    placeholder="Contoh: Ballroom Lantai 3, masuk lewat lift samping..."
                    rows={3}
                    maxLength={300}
                    className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl text-xs focus:bg-white focus:outline-none focus:ring-2 focus:ring-pink-500/20"
                  />
                </div>
              </div>

            </div>
          )}

          {/* STEP 4: PEMBAYARAN */}
          {currentStep === 4 && (
            <div className="grid grid-cols-1 md:grid-cols-3 gap-4 items-start animate-in fade-in zoom-in-98 duration-200">
              
              <div className="md:col-span-2 bg-white rounded-2xl p-5 border border-slate-200/80 shadow-2xs space-y-5">
                <div className="flex items-center gap-2 pb-3 border-b border-slate-100">
                  <Sparkles className="w-5 h-5 text-[#EC167F]" />
                  <div>
                    <h2 className="text-sm font-extrabold text-slate-900">4. Pembayaran & Rincian Biaya</h2>
                    <p className="text-xs text-slate-500">Atur skema DP, diskon, dan status pembayaran</p>
                  </div>
                </div>

                <div className="bg-slate-50 border border-slate-200 rounded-2xl p-4 space-y-2.5 text-xs">
                  <span className="text-xs font-extrabold text-slate-900 block mb-1">Rincian Komponen Biaya</span>
                  
                  <div className="flex justify-between">
                    <span className="text-slate-500">Subtotal Layanan</span>
                    <span className="font-extrabold text-slate-800">Rp{subtotal.toLocaleString('id-ID')}</span>
                  </div>

                  <div className="flex justify-between">
                    <span className="text-slate-500">Transport <span className="text-emerald-600 font-bold">(Otomatis jarak)</span></span>
                    <span className="font-extrabold text-emerald-600">Rp{transportCost.toLocaleString('id-ID')}</span>
                  </div>

                  <div className="flex justify-between">
                    <span className="text-slate-500">Biaya Aksesoris / Tambahan</span>
                    <span className="font-extrabold text-slate-800">Rp{otherCost.toLocaleString('id-ID')}</span>
                  </div>

                  <div className="flex justify-between">
                    <span className="text-slate-500">Diskon Promo</span>
                    <span className="font-extrabold text-rose-600">-Rp{discount.toLocaleString('id-ID')}</span>
                  </div>

                  <div className="pt-3 border-t border-slate-200 flex justify-between items-center">
                    <span className="text-sm font-black text-slate-900">Grand Total</span>
                    <span className="text-lg font-black text-[#EC167F]">Rp{grandTotal.toLocaleString('id-ID')}</span>
                  </div>
                </div>

                {/* DP Input & Status */}
                <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
                  <div>
                    <label className="block text-xs font-bold text-slate-700 mb-1">
                      Nominal Down Payment (DP) <span className="text-rose-500">*</span>
                    </label>
                    <div className="flex items-center gap-2">
                      <div className="relative flex-1">
                        <span className="absolute left-3.5 top-2.5 text-xs font-bold text-slate-400">Rp</span>
                        <input 
                          type="text" 
                          value={dpAmount}
                          onChange={(e) => setDpAmount(e.target.value)}
                          disabled={noDp}
                          className="w-full pl-10 pr-3.5 py-2 bg-slate-50 border border-slate-200 rounded-xl text-xs font-bold focus:bg-white focus:outline-none"
                        />
                      </div>
                      <label className="flex items-center gap-1.5 text-xs text-slate-600 font-bold cursor-pointer shrink-0">
                        <input 
                          type="checkbox" 
                          checked={noDp}
                          onChange={(e) => setNoDp(e.target.checked)}
                          className="accent-[#EC167F] w-4 h-4"
                        />
                        <span>Tanpa DP</span>
                      </label>
                    </div>

                    <div className="flex justify-between text-xs pt-2 font-bold">
                      <span className="text-slate-500">Sisa Pelunasan H-1</span>
                      <span className="text-slate-900 font-black">Rp{remainingPayment.toLocaleString('id-ID')}</span>
                    </div>
                  </div>

                  <div>
                    <label className="block text-xs font-bold text-slate-700 mb-2">Status Pembayaran</label>
                    <div className="flex flex-col gap-2 text-xs font-semibold text-slate-700">
                      <label className="flex items-center gap-2 cursor-pointer p-2 bg-slate-50 border border-slate-200/80 rounded-xl">
                        <input 
                          type="radio" 
                          name="pmtStatusStep" 
                          checked={paymentStatus === 'Belum Bayar'} 
                          onChange={() => setPaymentStatus('Belum Bayar')}
                          className="accent-[#EC167F]" 
                        />
                        <span>Belum Bayar (Menunggu DP)</span>
                      </label>
                      <label className="flex items-center gap-2 cursor-pointer p-2 bg-pink-50/50 border border-pink-200 rounded-xl text-[#EC167F]">
                        <input 
                          type="radio" 
                          name="pmtStatusStep" 
                          checked={paymentStatus === 'DP Masuk'} 
                          onChange={() => setPaymentStatus('DP Masuk')}
                          className="accent-[#EC167F]" 
                        />
                        <span className="font-extrabold">DP Masuk (Dikonfirmasi)</span>
                      </label>
                      <label className="flex items-center gap-2 cursor-pointer p-2 bg-slate-50 border border-slate-200/80 rounded-xl">
                        <input 
                          type="radio" 
                          name="pmtStatusStep" 
                          checked={paymentStatus === 'Lunas'} 
                          onChange={() => setPaymentStatus('Lunas')}
                          className="accent-[#EC167F]" 
                        />
                        <span>Lunas (Full Paid)</span>
                      </label>
                    </div>
                  </div>
                </div>

              </div>

              {/* Rekomendasi Layanan Studio */}
              <div className="space-y-4">
                <div className="bg-pink-50/80 border border-pink-200/90 rounded-2xl p-4 space-y-3 text-xs shadow-2xs">
                  <div className="flex items-center justify-between">
                    <div className="flex items-center gap-1.5 font-black text-pink-900">
                      <Sparkles className="w-4 h-4 text-[#EC167F]" />
                      <span>Estimasi Margin & Tips Studio</span>
                    </div>
                    <span className="px-2 py-0.5 bg-pink-200 text-pink-800 text-[10px] font-black rounded-md">Estimasi</span>
                  </div>

                  <div className="flex justify-between text-xs font-bold pt-1">
                    <span className="text-slate-700">Estimasi profit booking ini</span>
                    <span className="text-emerald-600 font-black">Rp950.000</span>
                  </div>

                  <div className="pt-2 border-t border-pink-200/80 text-xs space-y-2">
                    <span className="font-extrabold text-slate-900 block">Saran Tambahan</span>
                    <p className="text-slate-600 text-[11px] leading-relaxed">
                      ✓ Disarankan menambah Touch Up jika durasi resepsi &gt; 6 jam.
                    </p>
                    <button 
                      type="button"
                      onClick={() => {
                        setAddonTouchup(true);
                        triggerToast('Touch Up ditambahkan!');
                      }}
                      className="w-full py-1.5 bg-white hover:bg-pink-100 text-[#EC167F] border border-pink-300 font-extrabold rounded-xl text-xs cursor-pointer transition-colors"
                    >
                      + Tambah Touch Up Standby
                    </button>
                  </div>
                </div>

                {/* Upload Bukti Transfer */}
                <div className="bg-white border border-slate-200/80 rounded-2xl p-4 shadow-2xs space-y-2">
                  <label className="block text-xs font-bold text-slate-700">Bukti Transfer DP (Opsional)</label>
                  <div className="grid grid-cols-2 gap-2 text-xs">
                    <button 
                      type="button"
                      onClick={() => triggerToast('Membuka kamera HP...')}
                      className="p-3 bg-slate-50 hover:bg-slate-100 border border-slate-200 rounded-xl font-bold text-slate-700 flex flex-col items-center justify-center gap-1 cursor-pointer"
                    >
                      <Camera className="w-4 h-4 text-slate-500" />
                      <span className="text-[10px]">Ambil Foto</span>
                    </button>
                    <button 
                      type="button"
                      onClick={() => triggerToast('Membuka galeri foto...')}
                      className="p-3 bg-slate-50 hover:bg-slate-100 border border-slate-200 rounded-xl font-bold text-slate-700 flex flex-col items-center justify-center gap-1 cursor-pointer"
                    >
                      <ImageIcon className="w-4 h-4 text-slate-500" />
                      <span className="text-[10px]">Dari Galeri</span>
                    </button>
                  </div>
                </div>
              </div>

            </div>
          )}

          {/* STEP 5: KONFIRMASI & RINGKASAN */}
          {currentStep === 5 && (
            <div className="bg-white rounded-2xl p-6 border border-slate-200/80 shadow-2xs space-y-6 animate-in fade-in zoom-in-98 duration-200">
              
              <div className="flex items-center justify-between pb-4 border-b border-slate-100">
                <div className="flex items-center gap-3">
                  <span className="w-10 h-10 rounded-2xl bg-emerald-50 text-emerald-600 flex items-center justify-center">
                    <CheckCircle2 className="w-6 h-6" />
                  </span>
                  <div>
                    <h2 className="text-base font-black text-slate-900">5. Konfirmasi Ringkasan Reservasi</h2>
                    <p className="text-xs text-slate-500">Periksa kembali data sebelum menyimpan atau mengirimkan invoice</p>
                  </div>
                </div>

                <span className="px-3 py-1 bg-pink-100 text-[#EC167F] text-xs font-black rounded-xl">
                  Status: Draft Siap Dibuat
                </span>
              </div>

              {/* Review Summary Grid */}
              <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
                
                {/* Box 1: Client & Service */}
                <div className="p-4 bg-slate-50 border border-slate-200/80 rounded-2xl space-y-3">
                  <div className="flex items-center justify-between">
                    <span className="text-xs font-black text-slate-900 uppercase tracking-wider">Client &amp; Layanan</span>
                    <button onClick={() => setCurrentStep(1)} className="text-[11px] font-bold text-[#EC167F] hover:underline cursor-pointer">
                      Edit Client
                    </button>
                  </div>
                  <div className="space-y-1.5 text-xs">
                    <div className="flex justify-between">
                      <span className="text-slate-400">Nama:</span>
                      <span className="font-extrabold text-slate-800">{clientName}</span>
                    </div>
                    <div className="flex justify-between">
                      <span className="text-slate-400">WhatsApp:</span>
                      <span className="font-bold text-slate-700">{clientPhone}</span>
                    </div>
                    <div className="flex justify-between">
                      <span className="text-slate-400">Instagram:</span>
                      <span className="font-bold text-slate-700">{clientIg}</span>
                    </div>
                    <div className="flex justify-between">
                      <span className="text-slate-400">Paket:</span>
                      <span className="font-extrabold text-[#EC167F]">Wedding Makeup Package</span>
                    </div>
                    <div className="flex justify-between">
                      <span className="text-slate-400">Orang Tambahan:</span>
                      <span className="font-bold text-slate-700">{persons.length} Orang</span>
                    </div>
                  </div>
                </div>

                {/* Box 2: Schedule & Location */}
                <div className="p-4 bg-slate-50 border border-slate-200/80 rounded-2xl space-y-3">
                  <div className="flex items-center justify-between">
                    <span className="text-xs font-black text-slate-900 uppercase tracking-wider">Waktu &amp; Lokasi</span>
                    <button onClick={() => setCurrentStep(3)} className="text-[11px] font-bold text-[#EC167F] hover:underline cursor-pointer">
                      Edit Acara
                    </button>
                  </div>
                  <div className="space-y-1.5 text-xs">
                    <div className="flex justify-between">
                      <span className="text-slate-400">Tanggal:</span>
                      <span className="font-extrabold text-slate-800">{eventDate}</span>
                    </div>
                    <div className="flex justify-between">
                      <span className="text-slate-400">Jam Mulai:</span>
                      <span className="font-bold text-slate-700">{eventTime} WIB</span>
                    </div>
                    <div className="flex justify-between">
                      <span className="text-slate-400">Estimasi Selesai:</span>
                      <span className="font-bold text-slate-700">22.36 WIB</span>
                    </div>
                    <div className="flex justify-between">
                      <span className="text-slate-400">Lokasi:</span>
                      <span className="font-bold text-slate-800 truncate max-w-[200px]">The Westin Jakarta</span>
                    </div>
                  </div>
                </div>

                {/* Box 3: Payment Summary */}
                <div className="md:col-span-2 p-4 bg-pink-50/50 border border-pink-200/80 rounded-2xl flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4">
                  <div>
                    <span className="text-xs font-extrabold text-slate-500 uppercase tracking-wider block">Ringkasan Tagihan</span>
                    <div className="flex items-baseline gap-2 mt-1">
                      <span className="text-2xl font-black text-[#EC167F]">Rp{grandTotal.toLocaleString('id-ID')}</span>
                      <span className="text-xs text-slate-600 font-bold">(DP: Rp{numericDp.toLocaleString('id-ID')} | Sisa: Rp{remainingPayment.toLocaleString('id-ID')})</span>
                    </div>
                  </div>

                  <div className="flex items-center gap-2">
                    <button 
                      type="button"
                      onClick={() => handleSubmit('draft')}
                      className="px-4 py-2 bg-white hover:bg-slate-50 border border-slate-200 text-slate-700 font-bold rounded-xl text-xs cursor-pointer"
                    >
                      Simpan Draft
                    </button>
                    <button 
                      type="button"
                      onClick={() => handleSubmit('invoice')}
                      className="px-4 py-2 bg-[#EC167F] hover:bg-[#D41270] text-white font-extrabold rounded-xl text-xs shadow-xs cursor-pointer"
                    >
                      Create &amp; Send Invoice WhatsApp
                    </button>
                  </div>
                </div>

              </div>

            </div>
          )}

        </div>
      {/* Bottom Sticky Action Bar with Prev / Next Navigation */}
      <div className="bg-white p-4 rounded-2xl border border-slate-200/80 shadow-lg flex flex-col sm:flex-row items-center justify-between gap-3 text-xs">
        
        {/* Left: Back / Cancel Button */}
        <div className="flex items-center gap-2 w-full sm:w-auto">
          <button 
            type="button"
            onClick={onCancel}
            className="px-4 py-2 bg-slate-100 hover:bg-slate-200 text-slate-700 font-bold rounded-xl transition-colors cursor-pointer"
          >
            Batal
          </button>

          {currentStep > 1 && (
            <button 
              type="button"
              onClick={handlePrevStep}
              className="px-4 py-2 border border-slate-200 hover:bg-slate-50 text-slate-800 font-bold rounded-xl transition-colors flex items-center gap-1 cursor-pointer"
            >
              <ChevronLeft className="w-4 h-4" />
              <span>Kembali</span>
            </button>
          )}
        </div>

        {/* Center: Step Counter Indicator */}
        <span className="text-xs font-extrabold text-slate-500">
          Langkah <strong className="text-[#EC167F]">{currentStep}</strong> dari 5
        </span>

        {/* Right: Next / Save Actions */}
        <div className="flex items-center gap-2 w-full sm:w-auto justify-end">
          <button 
            type="button"
            onClick={() => handleSubmit('draft')}
            className="px-4 py-2 border border-slate-200 hover:bg-slate-50 text-slate-700 font-bold rounded-xl transition-colors cursor-pointer hidden sm:inline-block"
          >
            Simpan Draft
          </button>

          {currentStep < 5 ? (
            <button 
              type="button"
              onClick={handleNextStep}
              className="px-5 py-2 bg-[#EC167F] hover:bg-[#D41270] text-white font-black rounded-xl shadow-xs transition-all flex items-center gap-1.5 cursor-pointer"
            >
              <span>Lanjutkan</span>
              <ChevronRight className="w-4 h-4" />
            </button>
          ) : (
            <button 
              type="button"
              onClick={() => handleSubmit('final')}
              className="px-5 py-2 bg-[#EC167F] hover:bg-[#D41270] text-white font-black rounded-xl shadow-xs transition-all flex items-center gap-1.5 cursor-pointer"
            >
              <Check className="w-4 h-4 stroke-[3]" />
              <span>Buat Reservasi Sekarang</span>
            </button>
          )}
        </div>

      </div>

    </div>
  );
};

Zerion Mini Shell 1.0