@php $tabs = [ ['id' => 'domains', 'label' => __('Domains'), 'icon' => 'M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9'], ['id' => 'settings', 'label' => __('Settings'), 'icon' => 'M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z'], ]; @endphp
{{-- Flash success --}} @if(session('success'))
{{ session('success') }}
@endif {{-- Flash error --}} @if(session('error'))
{{ session('error') }}
@endif {{-- Tab Navigation (pill-style, same as System Settings) --}}
@foreach($tabs as $tab) @endforeach
{{-- ══════════════════════════════════════════════════════════════ TAB 1: DOMAINS ══════════════════════════════════════════════════════════════ --}}
{{-- Stats Cards --}}

{{ $totalDomains }}

{{ __('Total Domains') }}

{{ $activeDomains }}

{{ __('Active Domains') }}

{{ $totalActiveAddresses }}

{{ __('Total Active Addresses') }}

{{-- Header + Search + Add --}}

{{ __('Domain Directory') }}

{{ $domains->count() }} domain(s) found. {{ $activeDomains }} active.

{{-- Domain List (accordion panels like payment-gateways) --}}
@forelse($domains as $domain)
{{-- Header --}}
@csrf
{{-- Expanded Edit Form --}}
@csrf @method('PUT') {{-- Domain & Display --}}

{{ __('Domain Details') }}

{{-- IMAP Configuration --}}

{{ __('IMAP Configuration') }}

@if($domain->imap_password)

{{ __('Saved (hidden). Leave blank to keep current value.') }}

@endif
{{-- Limits & Patterns --}}

{{ __('Limits & Filters') }}

{{ __('Comma-separated local parts or keywords to block.') }}

{{-- Error message display --}} @if($domain->status === 'error' && $domain->error_message)

{{ __('Last Error') }}

{{ $domain->error_message }}

@endif {{-- Action Buttons --}}
{{-- Test Connection --}} {{ __('Test Connection') }} {{-- Sync Now --}} {{ __('Sync Now') }} {{-- Delete --}}
{{-- Hidden forms for test/sync --}}
{{-- Delete Confirmation Modal --}}
@csrf @method('DELETE')

Delete "{{ $domain->domain }}"?

{!! __('This domain and its configuration will be permanently removed. Active addresses must be deactivated first.') !!}

@empty

{{ __('No domains found. Add your first temp mail domain to get started.') }}

@endforelse
{{-- ══════════════════════════════════════════════════════════════ TAB 2: SETTINGS ══════════════════════════════════════════════════════════════ --}}
@csrf

{{ __('Global Temp Mail Settings') }}

{{ __('Configure default behavior for all temporary email domains.') }}

{{-- Temp Mail Enabled Toggle --}}

{{ __('How long new temp addresses stay active by default.') }}

{{ __('Expired addresses and their messages are permanently deleted after this many days.') }}

{{ __('Comma-separated keywords. Addresses containing these words will be rejected globally.') }}

{{-- Create Domain Modal --}}
@csrf

{{ __('Add Domain') }}

{{ __('Configure a new temporary email domain with IMAP credentials.') }}