<div class="row">
    <div class="col-md-6">
        <h6 class="fw-bold mb-3">{{ __('store.clientarea_domains_general_info') }}</h6>

        <div class="mb-3">
            <label class="form-label text-muted">{{ __('store.domain_title') }}</label>
            <div class="fw-bold">{{ $domain->domain }}</div>
        </div>

        <div class="mb-3">
            <label class="form-label text-muted">{{ __('store.common_status') }}</label>
            <div>
                @php
                    $statusClass = match($domain->status) {
                        'active' => 'success',
                        'pending' => 'warning',
                        'suspended' => 'danger',
                        'expired' => 'secondary',
                        default => 'secondary'
                    };
                @endphp
                <span class="badge bg-{{ $statusClass }}">
                    {{ ucfirst(__('store.clientarea_domains_status_' . $domain->status)) }}
                </span>
            </div>
        </div>

        <div class="mb-3">
            <label class="form-label text-muted">{{ __('store.clientarea_domains_tld') }}</label>
            <div class="fw-bold">{{ $domain->tld?->name ?? '-' }}</div>
        </div>

        <div class="mb-3">
            <label class="form-label text-muted">{{ __('store.clientarea_domains_period') }}</label>
            <div class="fw-bold">{{ $domain->period }} {{ __('store.common_years') }}</div>
        </div>

        @if($domain->module)
        <div class="mb-3">
            <label class="form-label text-muted">{{ __('store.clientarea_domains_registrar') }}</label>
            <div class="fw-bold">{{ ucfirst($domain->module) }}</div>
        </div>
        @endif
    </div>

    <div class="col-md-6">
        <h6 class="fw-bold mb-3">{{ __('store.clientarea_domains_dates') }}</h6>

        @if($domain->create_date)
        <div class="mb-3">
            <label class="form-label text-muted">{{ __('store.clientarea_domains_registration_date') }}</label>
            <div class="fw-bold">{{ $domain->create_date->format($dateTimeFormat) }}</div>
        </div>
        @endif

        @if($domain->expire_date)
        <div class="mb-3">
            <label class="form-label text-muted">{{ __('store.clientarea_domains_expiry_date') }}</label>
            <div class="fw-bold">
                {{ $domain->expire_date->format($dateTimeFormat) }}
                @php
                    $daysToExpiry = $domain->expire_date->diffInDays(now(), false);
                @endphp
                @if($daysToExpiry < 0)
                    <br><small class="text-danger">{{ abs($daysToExpiry) }} {{ __('store.clientarea_domains_days_to_expiry') }}</small>
                @elseif($daysToExpiry < 30)
                    <br><small class="text-warning">{{ abs($daysToExpiry) }} {{ __('store.clientarea_domains_days_to_expiry') }}</small>
                @else
                    <br><small class="text-success">{{ $daysToExpiry }} {{ __('store.clientarea_domains_days_to_expiry') }}</small>
                @endif
            </div>
        </div>
        @endif

        @if($domain->due_date)
        <div class="mb-3">
            <label class="form-label text-muted">{{ __('store.clientarea_domains_due_date') }}</label>
            <div class="fw-bold">{{ $domain->due_date->format($dateTimeFormat) }}</div>
        </div>
        @endif

        @if($domain->next_due_date)
        <div class="mb-3">
            <label class="form-label text-muted">{{ __('store.clientarea_domains_next_due_date') }}</label>
            <div class="fw-bold">{{ $domain->next_due_date->format($dateTimeFormat) }}</div>
        </div>
        @endif
    </div>
</div>

<hr class="my-4">

<div class="row">
    <div class="col-md-6">
        <h6 class="fw-bold mb-3">{{ __('store.clientarea_domains_features') }}</h6>

        <div class="mb-2">
            <div class="d-flex justify-content-between align-items-center">
                <span>{{ __('store.clientarea_domains_auto_renew') }}</span>
                @if($domain->auto_renew)
                    <span class="badge bg-success">{{ __('store.common_enabled') }}</span>
                @else
                    <span class="badge bg-secondary">{{ __('store.common_disabled') }}</span>
                @endif
            </div>
        </div>

        <div class="mb-2">
            <div class="d-flex justify-content-between align-items-center">
                <span>{{ __('store.clientarea_domains_dns_management') }}</span>
                @if($domain->dns_management)
                    <span class="badge bg-success">{{ __('store.common_enabled') }}</span>
                @else
                    <span class="badge bg-secondary">{{ __('store.common_disabled') }}</span>
                @endif
            </div>
        </div>

        <div class="mb-2">
            <div class="d-flex justify-content-between align-items-center">
                <span>{{ __('store.clientarea_domains_email_forwarding') }}</span>
                @if($domain->email_forwarding)
                    <span class="badge bg-success">{{ __('store.common_enabled') }}</span>
                @else
                    <span class="badge bg-secondary">{{ __('store.common_disabled') }}</span>
                @endif
            </div>
        </div>

        <div class="mb-2">
            <div class="d-flex justify-content-between align-items-center">
                <span>{{ __('store.clientarea_domains_privacy_protection') }}</span>
                @if($domain->id_protection)
                    <span class="badge bg-success">{{ __('store.common_enabled') }}</span>
                @else
                    <span class="badge bg-secondary">{{ __('store.common_disabled') }}</span>
                @endif
            </div>
        </div>

        @if($domain->is_premium)
        <div class="mb-2">
            <div class="d-flex justify-content-between align-items-center">
                <span>{{ __('store.clientarea_domains_premium_domain') }}</span>
                <span class="badge bg-warning">{{ __('store.common_yes') }}</span>
            </div>
        </div>
        @endif
    </div>

    <div class="col-md-6">
        <h6 class="fw-bold mb-3">{{ __('store.clientarea_domains_settings') }}</h6>

        <div class="mb-2">
            <div class="d-flex justify-content-between align-items-center">
                <span>{{ __('store.clientarea_domains_disable_reminders') }}</span>
                @if($domain->disable_reminders)
                    <span class="badge bg-warning">{{ __('store.common_disabled') }}</span>
                @else
                    <span class="badge bg-success">{{ __('store.common_enabled') }}</span>
                @endif
            </div>
        </div>

        @if($domain->last_check)
        <div class="mb-3">
            <label class="form-label text-muted">{{ __('store.clientarea_domains_last_check') }}</label>
            <div class="fw-bold">{{ $domain->last_check->format($dateTimeFormat) }}</div>
        </div>
        @endif
    </div>
</div>

@if($domain->fields && $domain->fields->count() > 0)
<hr class="my-4">

<div class="row">
    <div class="col-12">
        <h6 class="fw-bold mb-3">{{ __('store.clientarea_domains_custom_fields') }}</h6>

        <div class="table-responsive">
            <table class="table table-sm">
                @foreach($domain->fields as $field)
                <tr>
                    <td class="text-muted">{{ $field->field_name }}</td>
                    <td class="fw-bold">{{ $field->field_value }}</td>
                </tr>
                @endforeach
            </table>
        </div>
    </div>
</div>
@endif
