@extends('layouts.app')

@section('title', 'Tambah Pelanggan - Kei\'s Store')

@section('content')
<div class="container-fluid px-4">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h3 class="fw-bold text-pink-gradient">Tambah Pelanggan Baru</h3>
      
    </div>

    {{-- Error Alert --}}
    @if($errors->any())
        <div class="alert alert-pink alert-dismissible fade show shadow-sm mb-4" role="alert">
            <div class="d-flex align-items-center">
                <i class="bi bi-exclamation-triangle-fill me-2 fs-5"></i>
                <div>
                    <h6 class="alert-heading mb-1">Terjadi Kesalahan!</h6>
                    <ul class="mb-0 ps-3">
                        @foreach($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
            </div>
            <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
        </div>
    @endif

    <div class="card shadow-pink border-0">
        <div class="card-header bg-pink-gradient text-white py-3">
            <h5 class="mb-0">
                <i class="bi bi-plus-circle-fill me-2"></i>Form Tambah Pelanggan
            </h5>
        </div>

        <div class="card-body p-4">

            <form action="{{ route('pelanggan.store') }}" method="POST" class="needs-validation" novalidate>
                @csrf

                {{-- Nama Pelanggan --}}
                <div class="mb-4">
                    <label class="form-label fw-semibold text-pink-dark">
                        <i class="bi bi-person-fill me-2"></i>Nama Pelanggan
                    </label>

                    <div class="input-group input-group-lg">
                        <span class="input-group-text bg-soft-pink border-pink">
                            <i class="bi bi-person-heart text-pink"></i>
                        </span>
                        <input type="text"
                               name="nama_pelanggan"
                               value="{{ old('nama_pelanggan') }}"
                               class="form-control border-pink focus-pink"
                               placeholder="Masukkan nama pelanggan..."
                               required>
                    </div>
                </div>

                {{-- Alamat --}}
                <div class="mb-4">
                    <label class="form-label fw-semibold text-pink-dark">
                        <i class="bi bi-geo-alt-fill me-2"></i>Alamat
                    </label>

                    <div class="input-group input-group-lg">
                        <span class="input-group-text bg-soft-pink border-pink">
                            <i class="bi bi-geo text-pink"></i>
                        </span>
                        <textarea name="alamat"
                                  class="form-control border-pink focus-pink"
                                  rows="3"
                                  placeholder="Masukkan alamat pelanggan..."
                                  required>{{ old('alamat') }}</textarea>
                    </div>
                </div>

                {{-- Nomor Telepon --}}
                <div class="mb-4">
                    <label class="form-label fw-semibold text-pink-dark">
                        <i class="bi bi-telephone-fill me-2"></i>Nomor Telepon
                    </label>

                    <div class="input-group input-group-lg">
                        <span class="input-group-text bg-soft-pink border-pink">
                            <i class="bi bi-telephone-plus text-pink"></i>
                        </span>
                        <input type="text"
                               name="nomor_telepon"
                               value="{{ old('nomor_telepon') }}"
                               class="form-control border-pink focus-pink"
                               placeholder="Contoh: 081234567890"
                               required>
                    </div>
                </div>

                {{-- Status --}}
                <div class="mb-4">
                    <label class="form-label fw-semibold text-pink-dark">
                        <i class="bi bi-toggle-on me-2"></i>Status
                    </label>

                    <div class="input-group input-group-lg">
                        <span class="input-group-text bg-soft-pink border-pink">
                            <i class="bi bi-person-check text-pink"></i>
                        </span>
                        <select name="status"
                                class="form-select border-pink focus-pink"
                                required>
                            <option value="aktif" {{ old('status') == 'aktif' ? 'selected' : '' }}>
                                Aktif
                            </option>
                            <option value="nonaktif" {{ old('status') == 'nonaktif' ? 'selected' : '' }}>
                                Nonaktif
                            </option>
                        </select>
                    </div>
                </div>

                {{-- Tombol Aksi --}}
                <div class="d-flex gap-3 pt-3">
                    <button type="submit" class="btn btn-pink-glow px-4 py-2">
                        <i class="bi bi-check-lg me-2"></i>Simpan Pelanggan
                    </button>

                    <a href="{{ route('pelanggan.index') }}" class="btn btn-outline-pink px-4 py-2">
                        <i class="bi bi-x-lg me-2"></i>Batal
                    </a>
                </div>

            </form>

        </div>
    </div>
</div>
<style>
    .text-pink-gradient {
        background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .bg-pink-gradient {
        background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    }
    
    .btn-pink-glow {
        background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
        border: none;
        color: white;
        font-weight: 600;
        padding: 12px 24px;
        border-radius: 10px;
        transition: all 0.3s ease;
        box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
    }
    
    .btn-pink-glow:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(236, 72, 153, 0.5);
        color: white;
    }
    
    .btn-outline-pink {
        border: 2px solid #ec4899;
        color: #ec4899;
        font-weight: 500;
        padding: 12px 24px;
        border-radius: 10px;
        transition: all 0.3s ease;
        background: transparent;
    }
    
    .btn-outline-pink:hover {
        background: #ec4899;
        color: white;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
    }
    
    .shadow-pink {
        box-shadow: 0 4px 25px rgba(236, 72, 153, 0.1);
        border: 1px solid #fdf2f8;
    }
    
    .border-pink {
        border-color: #fbcfe8 !important;
    }
    
    .bg-soft-pink {
        background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
    }
    
    .text-pink-dark {
        color: #be185d;
    }
    
    .alert-pink {
        background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
        border: 1px solid #fbcfe8;
        color: #be185d;
        border-radius: 12px;
    }
    
    .input-group-text.bg-soft-pink {
        background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
        border: 1px solid #f9a8d4;
        border-right: none;
    }
    
    .form-control.border-pink {
        border: 1px solid #f9a8d4;
        border-left: none;
        transition: all 0.3s ease;
    }
    
    .form-control.border-pink:focus {
        border-color: #ec4899;
        box-shadow: 0 0 0 0.2rem rgba(236, 72, 153, 0.25);
    }
    
    .focus-pink:focus {
        border-color: #ec4899 !important;
        box-shadow: 0 0 0 0.2rem rgba(236, 72, 153, 0.25) !important;
    }
    
    .card {
        border-radius: 16px;
        overflow: hidden;
    }
    
    .needs-validation .form-control:invalid {
        border-color: #f43f5e;
    }
    
    .needs-validation .form-control:valid {
        border-color: #10b981;
    }
</style>


@endsection
