<div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
    <!-- Advanced Header with Status & Actions -->
    <div class="bg-gradient-to-r from-purple-50 to-blue-50 dark:from-purple-900/10 dark:to-blue-900/10 rounded-2xl border border-purple-200 dark:border-purple-800 p-6 mb-8">
        <div class="flex items-center justify-between">
            <div class="flex items-center space-x-4">
                <div class="h-16 w-16 bg-gradient-to-br from-purple-500 to-blue-600 rounded-xl flex items-center justify-center shadow-lg">
                    <svg class="h-8 w-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
                    </svg>
                </div>
                <div>
                    <h1 class="text-3xl font-bold tracking-tight bg-gradient-to-r from-purple-600 to-blue-600 bg-clip-text text-transparent">
                        Estimate #{{ $estimate->estimate_number }}
                    </h1>
                    <p class="text-sm text-zinc-600 dark:text-zinc-400 mt-1">
                        @if($estimate->jobCard)
                            Job Card #{{ $estimate->jobCard->job_card_number }} • {{ $estimate->created_at->format('M j, Y') }}
                        @else
                            Standalone Estimate • {{ $estimate->created_at->format('M j, Y') }}
                        @endif
                    </p>
                    <div class="flex items-center space-x-3 mt-2">
                        <span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold
                            @switch($estimate->status)
                                @case('draft') bg-zinc-100 text-zinc-800 dark:bg-zinc-800 dark:text-zinc-200 @break
                                @case('sent') bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200 @break
                                @case('approved') bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 @break
                                @case('rejected') bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200 @break
                                @case('expired') bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200 @break
                            @endswitch
                        ">
                            {{ ucfirst($estimate->status) }}
                        </span>
                        <span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold
                            @switch($estimate->customer_approval_status)
                                @case('pending') bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200 @break
                                @case('approved') bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 @break
                                @case('rejected') bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200 @break
                            @endswitch
                        ">
                            Customer: {{ ucfirst($estimate->customer_approval_status) }}
                        </span>
                        @if($estimate->validity_period_days)
                            <span class="text-xs text-zinc-500 dark:text-zinc-400">
                                Valid until {{ $estimate->valid_until->format('M j, Y') }}
                            </span>
                        @endif
                    </div>
                </div>
            </div>
            
            <!-- Advanced Action Menu -->
            <div class="flex items-center space-x-3">
                @if($estimate->status === 'draft')
                    <button wire:click="sendToCustomer" class="inline-flex items-center px-4 py-2 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-700 hover:to-blue-800 text-white font-medium rounded-lg transition-all duration-200 shadow-lg transform hover:scale-105">
                        <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/>
                        </svg>
                        Send to Customer
                    </button>
                @endif
                
                <div class="relative" x-data="{ open: false }">
                    <button @click="open = !open" class="inline-flex items-center px-4 py-2 border border-zinc-300 dark:border-zinc-600 hover:bg-zinc-50 dark:hover:bg-zinc-700 text-zinc-700 dark:text-zinc-300 font-medium rounded-lg transition-colors">
                        <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"/>
                        </svg>
                        Actions
                    </button>
                    
                    <div x-show="open" @click.away="open = false" x-transition class="absolute right-0 mt-2 w-48 bg-white dark:bg-zinc-800 rounded-lg shadow-lg border border-zinc-200 dark:border-zinc-700 z-50">
                        <div class="py-1">
                            <a href="{{ route('estimates.edit', $estimate) }}" class="flex items-center px-4 py-2 text-sm text-zinc-700 dark:text-zinc-300 hover:bg-zinc-50 dark:hover:bg-zinc-700">
                                <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
                                </svg>
                                Edit Estimate
                            </a>
                            <button wire:click="duplicateEstimate" class="w-full flex items-center px-4 py-2 text-sm text-zinc-700 dark:text-zinc-300 hover:bg-zinc-50 dark:hover:bg-zinc-700">
                                <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/>
                                </svg>
                                Duplicate Estimate
                            </button>
                            <button wire:click="downloadPDF" class="w-full flex items-center px-4 py-2 text-sm text-zinc-700 dark:text-zinc-300 hover:bg-zinc-50 dark:hover:bg-zinc-700">
                                <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
                                </svg>
                                Download PDF
                            </button>
                            @if($estimate->status === 'approved')
                                <a href="{{ route('work-orders.create', $estimate) }}" class="flex items-center px-4 py-2 text-sm text-green-600 dark:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/20">
                                    <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"/>
                                    </svg>
                                    Create Work Order
                                </a>
                            @endif
                        </div>
                    </div>
                </div>
                
                @if($estimate->jobCard)
                    <a href="{{ route('job-cards.show', $estimate->jobCard) }}" class="inline-flex items-center px-4 py-2 bg-zinc-600 hover:bg-zinc-700 text-white font-medium rounded-lg transition-colors shadow-sm">
                        <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
                        </svg>
                        View Job Card
                    </a>
                @else
                    <a href="{{ route('estimates.index') }}" class="inline-flex items-center px-4 py-2 bg-zinc-600 hover:bg-zinc-700 text-white font-medium rounded-lg transition-colors shadow-sm">
                        <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
                        </svg>
                        Back to Estimates
                    </a>
                @endif
            </div>
        </div>
    </div>

    <!-- Advanced Two-Column Layout -->
    <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
        <!-- Main Content Column -->
        <div class="lg:col-span-2 space-y-8">
            <!-- Customer & Vehicle Information Card -->
            <div class="bg-white dark:bg-zinc-800 rounded-xl border border-zinc-200 dark:border-zinc-700 shadow-sm">
                <div class="px-6 py-4 border-b border-zinc-200 dark:border-zinc-700 bg-gradient-to-r from-zinc-50 to-zinc-100 dark:from-zinc-800 dark:to-zinc-700 rounded-t-xl">
                    <h2 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100 flex items-center">
                        <svg class="w-5 h-5 mr-2 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/>
                        </svg>
                        Customer & Vehicle Details
                    </h2>
                </div>
                <div class="p-6">
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                        <div class="space-y-4">
                            <div class="flex items-center space-x-3">
                                <div class="h-10 w-10 bg-blue-100 dark:bg-blue-900 rounded-lg flex items-center justify-center">
                                    <svg class="h-5 w-5 text-blue-600 dark:text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/>
                                    </svg>
                                </div>
                                <div>
                                    @if($estimate->customer_id)
                                        {{-- Standalone estimate --}}
                                        <p class="text-sm font-medium text-zinc-900 dark:text-zinc-100">{{ $estimate->customer->name }}</p>
                                        <p class="text-xs text-zinc-500 dark:text-zinc-400">{{ $estimate->customer->phone }}</p>
                                        <p class="text-xs text-zinc-500 dark:text-zinc-400">{{ $estimate->customer->email }}</p>
                                    @elseif($estimate->jobCard?->customer)
                                        {{-- Job card-based estimate --}}
                                        <p class="text-sm font-medium text-zinc-900 dark:text-zinc-100">{{ $estimate->jobCard->customer->name }}</p>
                                        <p class="text-xs text-zinc-500 dark:text-zinc-400">{{ $estimate->jobCard->customer->phone }}</p>
                                        <p class="text-xs text-zinc-500 dark:text-zinc-400">{{ $estimate->jobCard->customer->email }}</p>
                                    @else
                                        <p class="text-sm font-medium text-zinc-900 dark:text-zinc-100">Unknown Customer</p>
                                        <p class="text-xs text-zinc-500 dark:text-zinc-400">No contact information</p>
                                    @endif
                                </div>
                            </div>
                        </div>
                        <div class="space-y-4">
                            <div class="flex items-center space-x-3">
                                <div class="h-10 w-10 bg-green-100 dark:bg-green-900 rounded-lg flex items-center justify-center">
                                    <svg class="h-5 w-5 text-green-600 dark:text-green-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
                                    </svg>
                                </div>
                                <div>
                                    @if($estimate->vehicle_id)
                                        {{-- Standalone estimate --}}
                                        <p class="text-sm font-medium text-zinc-900 dark:text-zinc-100">
                                            {{ $estimate->vehicle->year }} {{ $estimate->vehicle->make }} {{ $estimate->vehicle->model }}
                                        </p>
                                        <p class="text-xs text-zinc-500 dark:text-zinc-400">{{ $estimate->vehicle->license_plate }}</p>
                                        <p class="text-xs text-zinc-500 dark:text-zinc-400">VIN: {{ $estimate->vehicle->vin }}</p>
                                    @elseif($estimate->jobCard?->vehicle)
                                        {{-- Job card-based estimate --}}
                                        <p class="text-sm font-medium text-zinc-900 dark:text-zinc-100">
                                            {{ $estimate->jobCard->vehicle->year }} {{ $estimate->jobCard->vehicle->make }} {{ $estimate->jobCard->vehicle->model }}
                                        </p>
                                        <p class="text-xs text-zinc-500 dark:text-zinc-400">{{ $estimate->jobCard->vehicle->license_plate }}</p>
                                        <p class="text-xs text-zinc-500 dark:text-zinc-400">VIN: {{ $estimate->jobCard->vehicle->vin }}</p>
                                    @else
                                        <p class="text-sm font-medium text-zinc-900 dark:text-zinc-100">Unknown Vehicle</p>
                                        <p class="text-xs text-zinc-500 dark:text-zinc-400">No vehicle information</p>
                                    @endif
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Advanced Line Items with Interactive Features -->
            <div class="bg-white dark:bg-zinc-800 rounded-xl border border-zinc-200 dark:border-zinc-700 shadow-sm">
                <div class="px-6 py-4 border-b border-zinc-200 dark:border-zinc-700 bg-gradient-to-r from-zinc-50 to-zinc-100 dark:from-zinc-800 dark:to-zinc-700 rounded-t-xl">
                    <div class="flex items-center justify-between">
                        <h2 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100 flex items-center">
                            <svg class="w-5 h-5 mr-2 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"/>
                            </svg>
                            Service Items & Parts
                            <span class="ml-2 text-xs bg-purple-100 dark:bg-purple-900 text-purple-600 dark:text-purple-400 px-2 py-1 rounded-full">
                                {{ $estimate->lineItems->count() }} items
                            </span>
                        </h2>
                        <button wire:click="toggleItemDetails" class="text-sm text-purple-600 dark:text-purple-400 hover:text-purple-800 dark:hover:text-purple-200 transition-colors">
                            {{ $showItemDetails ? 'Hide Details' : 'Show Details' }}
                        </button>
                    </div>
                </div>
                <div class="overflow-hidden">
                    <div class="overflow-x-auto">
                        <table class="w-full">
                            <thead class="bg-zinc-50 dark:bg-zinc-900">
                                <tr>
                                    <th class="px-6 py-3 text-left text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Description</th>
                                    <th class="px-6 py-3 text-center text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Qty</th>
                                    <th class="px-6 py-3 text-right text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Unit Price</th>
                                    <th class="px-6 py-3 text-right text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Total</th>
                                </tr>
                            </thead>
                            <tbody class="divide-y divide-zinc-200 dark:divide-zinc-700">
                                @foreach($estimate->lineItems as $item)
                                    <tr class="hover:bg-zinc-50 dark:hover:bg-zinc-700/50 transition-colors group">
                                        <td class="px-6 py-4">
                                            <div class="flex items-start space-x-3">
                                                <span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium
                                                    @switch($item->type)
                                                        @case('labor') bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200 @break
                                                        @case('parts') bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 @break
                                                        @case('miscellaneous') bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200 @break
                                                    @endswitch
                                                ">
                                                    {{ ucfirst($item->type) }}
                                                </span>
                                                <div class="flex-1">
                                                    <p class="text-sm font-medium text-zinc-900 dark:text-zinc-100">{{ $item->description }}</p>
                                                    @if($showItemDetails && $item->labor_hours)
                                                        <p class="text-xs text-zinc-500 dark:text-zinc-400 mt-1">
                                                            Labor: {{ $item->labor_hours }}h @ ${{ number_format($item->labor_rate, 2) }}/hr
                                                        </p>
                                                    @endif
                                                    @if($showItemDetails && $item->part_number)
                                                        <p class="text-xs text-zinc-500 dark:text-zinc-400 mt-1">
                                                            Part #: {{ $item->part_number }}
                                                        </p>
                                                    @endif
                                                </div>
                                            </div>
                                        </td>
                                        <td class="px-6 py-4 text-center">
                                            <span class="inline-flex items-center justify-center w-8 h-8 rounded-full bg-zinc-100 dark:bg-zinc-800 text-sm font-medium text-zinc-900 dark:text-zinc-100">
                                                {{ $item->quantity }}
                                            </span>
                                        </td>
                                        <td class="px-6 py-4 text-right">
                                            <span class="text-sm font-medium text-zinc-900 dark:text-zinc-100">
                                                ${{ number_format($item->unit_price, 2) }}
                                            </span>
                                        </td>
                                        <td class="px-6 py-4 text-right">
                                            <span class="text-sm font-semibold text-zinc-900 dark:text-zinc-100">
                                                ${{ number_format($item->total_amount, 2) }}
                                            </span>
                                        </td>
                                    </tr>
                                @endforeach
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

            <!-- Terms & Conditions -->
            @if($estimate->terms_and_conditions)
                <div class="bg-white dark:bg-zinc-800 rounded-xl border border-zinc-200 dark:border-zinc-700 shadow-sm">
                    <div class="px-6 py-4 border-b border-zinc-200 dark:border-zinc-700">
                        <h2 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100 flex items-center">
                            <svg class="w-5 h-5 mr-2 text-amber-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
                            </svg>
                            Terms & Conditions
                        </h2>
                    </div>
                    <div class="p-6">
                        <p class="text-sm text-zinc-600 dark:text-zinc-400 leading-relaxed">{{ $estimate->terms_and_conditions }}</p>
                    </div>
                </div>
            @endif
        </div>

        <!-- Advanced Sidebar -->
        <div class="space-y-6">
            <!-- Financial Summary Card -->
            <div class="bg-gradient-to-br from-green-50 to-emerald-50 dark:from-green-900/10 dark:to-emerald-900/10 rounded-xl border border-green-200 dark:border-green-800 shadow-sm">
                <div class="p-6">
                    <h3 class="text-lg font-semibold text-green-900 dark:text-green-100 mb-4 flex items-center">
                        <svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1"/>
                        </svg>
                        Financial Summary
                    </h3>
                    <div class="space-y-4">
                        <div class="flex justify-between items-center py-2 border-b border-green-200 dark:border-green-700">
                            <span class="text-sm font-medium text-green-700 dark:text-green-300">Labor Cost</span>
                            <span class="text-sm font-semibold text-green-900 dark:text-green-100">${{ number_format($estimate->labor_cost, 2) }}</span>
                        </div>
                        <div class="flex justify-between items-center py-2 border-b border-green-200 dark:border-green-700">
                            <span class="text-sm font-medium text-green-700 dark:text-green-300">Parts Cost</span>
                            <span class="text-sm font-semibold text-green-900 dark:text-green-100">${{ number_format($estimate->parts_cost, 2) }}</span>
                        </div>
                        @if($estimate->miscellaneous_cost > 0)
                            <div class="flex justify-between items-center py-2 border-b border-green-200 dark:border-green-700">
                                <span class="text-sm font-medium text-green-700 dark:text-green-300">Miscellaneous</span>
                                <span class="text-sm font-semibold text-green-900 dark:text-green-100">${{ number_format($estimate->miscellaneous_cost, 2) }}</span>
                            </div>
                        @endif
                        <div class="flex justify-between items-center py-2 border-b border-green-200 dark:border-green-700">
                            <span class="text-sm font-medium text-green-700 dark:text-green-300">Subtotal</span>
                            <span class="text-sm font-semibold text-green-900 dark:text-green-100">${{ number_format($estimate->subtotal, 2) }}</span>
                        </div>
                        @if($estimate->discount_amount > 0)
                            <div class="flex justify-between items-center py-2 border-b border-green-200 dark:border-green-700">
                                <span class="text-sm font-medium text-red-600 dark:text-red-400">Discount</span>
                                <span class="text-sm font-semibold text-red-600 dark:text-red-400">-${{ number_format($estimate->discount_amount, 2) }}</span>
                            </div>
                        @endif
                        <div class="flex justify-between items-center py-2 border-b border-green-200 dark:border-green-700">
                            <span class="text-sm font-medium text-green-700 dark:text-green-300">Tax ({{ $estimate->tax_rate }}%)</span>
                            <span class="text-sm font-semibold text-green-900 dark:text-green-100">${{ number_format($estimate->tax_amount, 2) }}</span>
                        </div>
                        <div class="flex justify-between items-center pt-4 border-t-2 border-green-300 dark:border-green-600">
                            <span class="text-lg font-bold text-green-900 dark:text-green-100">Total</span>
                            <span class="text-2xl font-bold text-green-900 dark:text-green-100">${{ number_format($estimate->total_amount, 2) }}</span>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Status Timeline -->
            <div class="bg-white dark:bg-zinc-800 rounded-xl border border-zinc-200 dark:border-zinc-700 shadow-sm">
                <div class="px-6 py-4 border-b border-zinc-200 dark:border-zinc-700">
                    <h3 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100 flex items-center">
                        <svg class="w-5 h-5 mr-2 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
                        </svg>
                        Status Timeline
                    </h3>
                </div>
                <div class="p-6">
                    <div class="space-y-4">
                        <div class="flex items-center space-x-3">
                            <div class="h-3 w-3 bg-green-500 rounded-full"></div>
                            <div class="flex-1">
                                <p class="text-sm font-medium text-zinc-900 dark:text-zinc-100">Created</p>
                                <p class="text-xs text-zinc-500 dark:text-zinc-400">{{ $estimate->created_at->format('M j, Y g:i A') }}</p>
                            </div>
                        </div>
                        @if($estimate->sent_at)
                            <div class="flex items-center space-x-3">
                                <div class="h-3 w-3 bg-blue-500 rounded-full"></div>
                                <div class="flex-1">
                                    <p class="text-sm font-medium text-zinc-900 dark:text-zinc-100">Sent to Customer</p>
                                    <p class="text-xs text-zinc-500 dark:text-zinc-400">{{ $estimate->sent_at->format('M j, Y g:i A') }}</p>
                                </div>
                            </div>
                        @endif
                        @if($estimate->customer_viewed_at)
                            <div class="flex items-center space-x-3">
                                <div class="h-3 w-3 bg-yellow-500 rounded-full"></div>
                                <div class="flex-1">
                                    <p class="text-sm font-medium text-zinc-900 dark:text-zinc-100">Viewed by Customer</p>
                                    <p class="text-xs text-zinc-500 dark:text-zinc-400">{{ $estimate->customer_viewed_at->format('M j, Y g:i A') }}</p>
                                </div>
                            </div>
                        @endif
                        @if($estimate->customer_responded_at)
                            <div class="flex items-center space-x-3">
                                <div class="h-3 w-3 {{ $estimate->customer_approval_status === 'approved' ? 'bg-green-500' : 'bg-red-500' }} rounded-full"></div>
                                <div class="flex-1">
                                    <p class="text-sm font-medium text-zinc-900 dark:text-zinc-100">Customer {{ ucfirst($estimate->customer_approval_status) }}</p>
                                    <p class="text-xs text-zinc-500 dark:text-zinc-400">{{ $estimate->customer_responded_at->format('M j, Y g:i A') }}</p>
                                </div>
                            </div>
                        @endif
                    </div>
                </div>
            </div>

            <!-- Related Documents -->
            <div class="bg-white dark:bg-zinc-800 rounded-xl border border-zinc-200 dark:border-zinc-700 shadow-sm">
                <div class="px-6 py-4 border-b border-zinc-200 dark:border-zinc-700">
                    <h3 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100 flex items-center">
                        <svg class="w-5 h-5 mr-2 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
                        </svg>
                        Related Documents
                    </h3>
                </div>
                <div class="p-6 space-y-3">
                    @if($estimate->diagnosis)
                        <a href="{{ route('diagnosis.show', $estimate->diagnosis) }}" class="flex items-center space-x-3 p-3 rounded-lg hover:bg-zinc-50 dark:hover:bg-zinc-700 transition-colors group">
                            <div class="h-8 w-8 bg-blue-100 dark:bg-blue-900 rounded-lg flex items-center justify-center group-hover:scale-110 transition-transform">
                                <svg class="h-4 w-4 text-blue-600 dark:text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
                                </svg>
                            </div>
                            <div class="flex-1">
                                <p class="text-sm font-medium text-zinc-900 dark:text-zinc-100">Diagnosis Report</p>
                                <p class="text-xs text-zinc-500 dark:text-zinc-400">View diagnostic findings</p>
                            </div>
                        </a>
                    @endif
                </div>
            </div>
        </div>
    </div>
</div>
