@extends('member.layouts.default')

@section('content')
<div class="container mx-auto px-4 py-12 transition-colors duration-300" dir="ltr">
    <!-- Main Side-by-Side Flex Container -->
    <div class="flex flex-col lg:flex-row items-stretch gap-12">
        
        <!-- Left Column: Content Block (50% Width on Large Screens) -->
        <div class="w-full lg:w-1/2 flex flex-col justify-start py-2">
            <h2 class="text-3xl font-bold text-gray-900 dark:text-white mb-6">
                {{ $meta->title ?? 'Contact Us' }}
            </h2>
            
            <!-- Prose custom styling container -->
            <div class="prose prose-blue dark:prose-invert max-w-none text-gray-600 dark:text-gray-300">
                <style>
                    /* Force standard block rendering and proper margins on raw HTML paragraphs */
                    .custom-html-content p { 
                        margin-bottom: 1.5rem !important; 
                        display: block !important; 
                        line-height: 1.75; 
                    }
                    /* Light mode links */
                    .custom-html-content a { 
                        color: #2563eb; 
                        text-decoration: underline; 
                        font-weight: 600; 
                    }
                    /* Dark mode links support */
                    .dark .custom-html-content a {
                        color: #60a5fa;
                    }
                </style>
                
                <div class="custom-html-content">
                    {!! $content !!}
                </div>
            </div>
        </div>

        <!-- Right Column: Form Container Block (50% Width on Large Screens) -->
        <div class="w-full lg:w-1/2">
            <div class="bg-white dark:bg-gray-800 p-8 rounded-2xl shadow-lg border border-gray-100 dark:border-gray-700/50 transition-colors duration-300 h-full">
                <h3 class="text-2xl font-bold text-gray-800 dark:text-white mb-2">Get in Touch</h3>
                <p class="text-gray-500 dark:text-gray-400 mb-8">Have any questions? Drop us a message and our support team will get back to you shortly.</p>

                @if(session('success'))
                    <div class="bg-green-50 dark:bg-green-900/30 border border-green-400 dark:border-green-600 text-green-700 dark:text-green-400 px-4 py-3 rounded-xl mb-6">
                        {{ session('success') }}
                    </div>
                @endif

                <form action="{{ route('contact.send') }}" method="POST">
                    @csrf
                    
                    <!-- Name Field -->
                    <div class="mb-4">
                        <label class="block text-gray-700 dark:text-gray-300 text-sm font-semibold mb-2">Your Name</label>
                        <input type="text" name="name" value="{{ old('name') }}" 
                            class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 focus:border-blue-500 dark:focus:border-blue-400 focus:ring-2 focus:ring-blue-200 dark:focus:ring-blue-900/50 outline-none transition" 
                            placeholder="John Doe" required>
                        @error('name') <span class="text-red-500 dark:text-red-400 text-xs mt-1 block">{{ $message }}</span> @enderror
                    </div>

                    <!-- Email Field -->
                    <div class="mb-4">
                        <label class="block text-gray-700 dark:text-gray-300 text-sm font-semibold mb-2">Email Address</label>
                        <input type="email" name="email" value="{{ old('email') }}" 
                            class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 focus:border-blue-500 dark:focus:border-blue-400 focus:ring-2 focus:ring-blue-200 dark:focus:ring-blue-900/50 outline-none transition" 
                            placeholder="name@example.com" required>
                        @error('email') <span class="text-red-500 dark:text-red-400 text-xs mt-1 block">{{ $message }}</span> @enderror
                    </div>

                    <!-- Subject Field -->
                    <div class="mb-4">
                        <label class="block text-gray-700 dark:text-gray-300 text-sm font-semibold mb-2">Subject</label>
                        <input type="text" name="subject" value="{{ old('subject') }}" 
                            class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 focus:border-blue-500 dark:focus:border-blue-400 focus:ring-2 focus:ring-blue-200 dark:focus:ring-blue-900/50 outline-none transition" 
                            placeholder="How can we help you?" required>
                        @error('subject') <span class="text-red-500 dark:text-red-400 text-xs mt-1 block">{{ $message }}</span> @enderror
                    </div>

                    <!-- Message Field -->
                    <div class="mb-6">
                        <label class="block text-gray-700 dark:text-gray-300 text-sm font-semibold mb-2">Message</label>
                        <textarea name="message" rows="5" 
                            class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 focus:border-blue-500 dark:focus:border-blue-400 focus:ring-2 focus:ring-blue-200 dark:focus:ring-blue-900/50 outline-none transition" 
                            placeholder="Type your message details here..." required>{{ old('message') }}</textarea>
                        @error('message') <span class="text-red-500 dark:text-red-400 text-xs mt-1 block">{{ $message }}</span> @enderror
                    </div>

                    <!-- Submit Button -->
                    <button type="submit" 
                        class="w-full inline-flex items-center justify-center px-6 py-3 bg-primary-600 hover:bg-primary-700 text-white font-bold rounded-2xl shadow-lg shadow-primary-500/20 transition-all duration-200 hover:scale-105 active:scale-95">
                        Send Message
                    </button>
                </form>
            </div>
        </div>

    </div>
</div>
@endsection