{{-- id="chat-root" es el ancla que usa el visualViewport JS para ajustar altura cuando aparece el teclado iOS. Ocupa todo el viewport disponible (cuerpo del body). --}}
{{-- ══ PASO 1: Formulario de inicio ══ --}} @if ($paso === 'telefono')

Chat en vivo

Ingresa tu número para comenzar

{{-- font-size 16px (via CSS global) evita el zoom automático en Safari --}} @error('telefono') {{ $message }} @enderror
{{-- min-height 48px = cumple Apple HIG de target táctil --}}
{{-- ══ PASO 2: Interfaz de chat ══ --}} @else
{{-- Header + safe area top (para el notch / Dynamic Island) --}}

Soporte en línea

@if ($estadoConv === 'agente') Atendido por un agente @elseif ($estadoConv === 'cerrada') Conversación cerrada @else Bot activo @endif

{{-- Mensajes — ios-scroll da momentum nativo en iPhone --}}
@forelse($mensajes as $msg) @if ($msg['tipo'] === 'usuario')

{{ $msg['contenido'] }}

{{ $msg['created_at'] }}
@else
@if ($msg['tipo'] === 'agente') Agente @endif

{{ $msg['contenido'] }}

{{ $msg['created_at'] }}
@endif @empty
Iniciando chat...
@endforelse {{-- Ancla para scroll al fondo --}}
{{-- Input + safe area bottom (home indicator iPhone X+) --}} @if ($estadoConv !== 'cerrada')
{{-- 44x44 mínimo Apple HIG --}}
@else
Esta conversación ha sido cerrada.
@endif
@endif