@extends('admin.layouts.app')

@section('content')
<div class="bg-gray-100 min-h-full p-4">
    
    <!-- Header Tab -->
    <div class="bg-[#ff9800] text-white px-4 py-2 font-bold flex items-center shadow-sm">
        <i class="fa-solid fa-list-ul mr-2"></i> 
        <span>Department</span>
    </div>

    <!-- Main Container -->
    <div class="bg-white p-6 shadow-sm min-h-[500px] border border-gray-200 border-t-0 flex flex-col justify-between">
        
        <form action="{{ route('departments.store') }}" method="POST" id="departmentForm">
            @csrf
            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                
                <div class="space-y-4">
                    <div>
                        <label class="block text-xs font-bold text-gray-800 mb-1">Department Name <span class="text-red-500">*</span></label>
                        <input type="text" name="name" value="{{ old('name') }}" required class="w-full border border-gray-300 px-3 py-1.5 text-sm focus:outline-none focus:border-[#ff9800]">
                    </div>
                    <div>
                        <label class="block text-xs font-bold text-gray-800 mb-1">Branch <span class="text-red-500">*</span></label>
                        <select name="branch_id" required class="w-full border border-gray-300 px-3 py-1.5 text-sm focus:outline-none focus:border-[#ff9800]">
                            <option value="">Select Branch...</option>
                            @foreach($branches as $branch)
                                <option value="{{ $branch->id }}">{{ $branch->name }}</option>
                            @endforeach
                        </select>
                    </div>
                    <div>
                        <label class="block text-xs font-bold text-gray-800 mb-1">Department Head Email Address</label>
                        <input type="email" name="head_email" value="{{ old('head_email') }}" class="w-full border border-gray-300 px-3 py-1.5 text-sm focus:outline-none focus:border-[#ff9800]">
                    </div>
                </div>

            </div>
        </form>

        <!-- Form Action Buttons aligned at the bottom like the screenshot -->
        <div class="mt-12 text-center space-x-2 pb-4">
            <button type="submit" form="departmentForm" class="bg-[#4caf50] hover:bg-[#43a047] text-white px-6 py-1.5 rounded shadow text-sm font-semibold">Save</button>
            <a href="{{ route('departments.index') }}" class="bg-[#f44336] hover:bg-[#e53935] text-white px-6 py-1.5 rounded shadow text-sm font-semibold inline-block">Cancel</a>
        </div>
    </div>
</div>
@endsection
