<div class="container-fluid py-4">
    <x-title>
        Communications settings
    </x-title>

    <div class="row g-4">
        {{-- Redress Scheme --}}
        <div class="col-lg-6">
            <x-card>
                <h5 class="mb-1">
                    <i class="mdi mdi-bank-outline me-1"></i>Scottish CA Redress Scheme
                </h5>
                <p class="text-muted small mb-3">
                    The single global inbox used when sending to the scheme. Shared across all solicitors.
                </p>

                @if($success)
                    <div class="alert alert-success alert-dismissible fade show py-2">
                        {{ $success }}
                        <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                    </div>
                @endif
                @if($error)
                    <div class="alert alert-danger py-2">{{ $error }}</div>
                @endif

                {{-- Current status --}}
                <div class="d-flex align-items-center gap-2 mb-3">
                    @if($schemeValidity)
                        <span class="badge bg-{{ $schemeValidity->validity->color() }}">
                            <i class="{{ $schemeValidity->validity->icon() }} me-1"></i>
                            {{ $schemeValidity->validity->label() }}
                        </span>
                        @if($schemeValidity->email)
                            <small class="text-muted">{{ $schemeValidity->email }}</small>
                        @elseif($schemeValidity->reason)
                            <small class="text-danger">{{ $schemeValidity->reason }}</small>
                        @endif
                    @else
                        <span class="badge bg-secondary">Not configured</span>
                    @endif
                </div>

                <form wire:submit.prevent="saveScheme">
                    <div class="mb-3">
                        <label class="form-label">Contact name</label>
                        <input type="text" class="form-control"
                               wire:model="schemeContactName"
                               placeholder="e.g. Jane Smith">
                    </div>
                    <div class="mb-3">
                        <label class="form-label">Email</label>
                        <input type="email" class="form-control"
                               wire:model="schemeEmail"
                               placeholder="scheme@example.com">
                        @error('schemeEmail')
                            <div class="text-danger small mt-1">{{ $message }}</div>
                        @enderror
                    </div>
                    <div class="mb-3">
                        <label class="form-label">Phone</label>
                        <input type="text" class="form-control"
                               wire:model="schemePhone"
                               placeholder="+44...">
                    </div>
                    <div class="d-flex justify-content-end">
                        <button type="submit" class="btn btn-primary">
                            <i class="mdi mdi-content-save me-1"></i>Save
                        </button>
                    </div>
                </form>
            </x-card>
        </div>
    </div>
</div>
