@extends('layouts.admin')

@section('title', 'Platform Settings – Admin CRM')
@section('page_title', 'System & Company Settings')

@section('content')
<div class="space-y-6 max-w-5xl">
    
    <div>
        <h2 class="text-lg font-bold text-white font-heading">Global Platform Configuration</h2>
        <p class="text-xs text-slate-400">Manage showroom contact numbers, WhatsApp concierge, and currency exchange defaults.</p>
    </div>

    <form method="POST" action="{{ route('admin.settings.update') }}" class="space-y-6">
        @csrf

        @foreach($settings as $group => $items)
            <div class="bg-slate-900 border border-white/10 rounded-2xl p-6 shadow-xl space-y-4">
                <h3 class="text-sm font-bold text-white font-heading uppercase tracking-wider border-b border-white/10 pb-3 flex items-center gap-2">
                    <i class="fa-solid fa-gear text-red-500"></i> {{ ucwords(str_replace('_', ' ', $group)) }} Settings
                </h3>

                <div class="grid grid-cols-1 sm:grid-cols-2 gap-4 text-xs">
                    @foreach($items as $setting)
                        <div>
                            <label class="block font-bold text-slate-300 uppercase text-[10px] mb-1">
                                {{ ucwords(str_replace('_', ' ', $setting->key)) }}
                            </label>
                            <input type="text" name="{{ $setting->key }}" value="{{ $setting->value }}" class="w-full bg-slate-950 border border-white/10 rounded-xl px-4 py-2 text-white text-xs font-semibold focus:border-red-500 focus:outline-none">
                            @if($setting->description)
                                <span class="text-[10px] text-slate-500 mt-1 block">{{ $setting->description }}</span>
                            @endif
                        </div>
                    @endforeach
                </div>
            </div>
        @endforeach

        <button type="submit" class="px-6 py-3 rounded-xl bg-red-600 hover:bg-red-700 text-white font-bold text-xs shadow-lg shadow-red-900/30 transition flex items-center gap-2">
            <i class="fa-solid fa-floppy-disk"></i>
            <span>Save Settings Configuration</span>
        </button>
    </form>

</div>
@endsection
