{{-- 
    Publishing Block: Text/Paragraph
    Rich text content with optional title
    
    Block Data Structure:
    {
        "type": "text",
        "title": "Section Title",
        "content": "<p>HTML content...</p>",
        "text_align": "left",
        "max_width": "default", // narrow, default, wide, full
        "background": "white" // white, gray, transparent
    }
--}}
@php
    $textAlign = $block['text_align'] ?? 'left';
    $maxWidth = $block['max_width'] ?? 'default';
    $background = $block['background'] ?? 'white';
    
    $maxWidthClasses = [
        'narrow' => 'max-w-5xl',
        'default' => 'max-w-4xl',
        'wide' => 'max-w-6xl',
        'full' => 'max-w-7xl',
    ];
    
    $backgroundClasses = [
        'white' => 'bg-white',
        'gray' => 'bg-gray-50',
        'transparent' => 'bg-transparent',
        'primary' => 'bg-green-50',
    ];
@endphp

<section class="py-12 lg:py-16 {{ $backgroundClasses[$background] ?? 'bg-white' }}">
    <div class="{{ $maxWidthClasses[$maxWidth] ?? 'max-w-4xl' }} mx-auto px-4 sm:px-6 lg:px-8">
        @if(!empty($block['title']))
            <h2 class="text-3xl md:text-4xl font-bold text-gray-800 mb-6 {{ $textAlign === 'center' ? 'text-center' : '' }}">
                {{ $block['title'] }}
            </h2>
        @endif
        
        @if(!empty($block['subtitle']))
            <p class="text-xl text-gray-600 mb-8 {{ $textAlign === 'center' ? 'text-center' : '' }}">
                {{ $block['subtitle'] }}
            </p>
        @endif
        
        <div class="prose prose-lg prose-green max-w-none {{ $textAlign === 'center' ? 'text-center' : '' }} {{ $textAlign === 'right' ? 'text-right' : '' }}">
            {!! $block['content'] ?? '' !!}
        </div>
        
        @if(!empty($block['button']))
            <div class="mt-8 {{ $textAlign === 'center' ? 'text-center' : '' }}">
                <a href="{{ $block['button']['url'] ?? '#' }}" 
                   class="inline-flex items-center px-6 py-3 bg-green-600 text-white font-semibold rounded-lg hover:bg-green-700 transition">
                    @if(!empty($block['button']['icon']))
                        <i class="fas fa-{{ $block['button']['icon'] }} mr-2"></i>
                    @endif
                    {{ $block['button']['label'] ?? 'Learn More' }}
                </a>
            </div>
        @endif
    </div>
</section>
