@extends('layouts.app')

@section('title', 'Compare Analysis')

@section('content')
<div class="container py-12">
    <div class="max-w-6xl mx-auto">
        <h1 class="text-3xl font-bold mb-8">Compare Analysis Results</h1>

        <div class="grid grid-cols-2 gap-6">
            <!-- Analysis 1 -->
            <div class="border rounded-lg p-6">
                <h3 class="text-xl font-bold mb-4">{{ $analysis1->company_name }}</h3>
                <table class="w-full text-sm mb-4">
                    <tr class="border-b">
                        <td class="font-semibold p-2">Period:</td>
                        <td class="p-2">{{ $analysis1->period }}</td>
                    </tr>
                    <tr class="border-b">
                        <td class="font-semibold p-2">Z-Score:</td>
                        <td class="p-2 text-lg font-bold">{{ round($analysis1->z_score, 2) }}</td>
                    </tr>
                    <tr class="border-b">
                        <td class="font-semibold p-2">Category:</td>
                        <td class="p-2">{{ ucfirst($analysis1->z_category) }}</td>
                    </tr>
                    <tr class="border-b">
                        <td class="font-semibold p-2">X1:</td>
                        <td class="p-2">{{ round($analysis1->x1, 4) }}</td>
                    </tr>
                    <tr class="border-b">
                        <td class="font-semibold p-2">X2:</td>
                        <td class="p-2">{{ round($analysis1->x2, 4) }}</td>
                    </tr>
                    <tr class="border-b">
                        <td class="font-semibold p-2">X3:</td>
                        <td class="p-2">{{ round($analysis1->x3, 4) }}</td>
                    </tr>
                    <tr class="border-b">
                        <td class="font-semibold p-2">X4:</td>
                        <td class="p-2">{{ round($analysis1->x4, 4) }}</td>
                    </tr>
                    <tr>
                        <td class="font-semibold p-2">X5:</td>
                        <td class="p-2">{{ round($analysis1->x5, 4) }}</td>
                    </tr>
                </table>
            </div>

            <!-- Analysis 2 -->
            <div class="border rounded-lg p-6">
                <h3 class="text-xl font-bold mb-4">{{ $analysis2->company_name }}</h3>
                <table class="w-full text-sm mb-4">
                    <tr class="border-b">
                        <td class="font-semibold p-2">Period:</td>
                        <td class="p-2">{{ $analysis2->period }}</td>
                    </tr>
                    <tr class="border-b">
                        <td class="font-semibold p-2">Z-Score:</td>
                        <td class="p-2 text-lg font-bold">{{ round($analysis2->z_score, 2) }}</td>
                    </tr>
                    <tr class="border-b">
                        <td class="font-semibold p-2">Category:</td>
                        <td class="p-2">{{ ucfirst($analysis2->z_category) }}</td>
                    </tr>
                    <tr class="border-b">
                        <td class="font-semibold p-2">X1:</td>
                        <td class="p-2">{{ round($analysis2->x1, 4) }}</td>
                    </tr>
                    <tr class="border-b">
                        <td class="font-semibold p-2">X2:</td>
                        <td class="p-2">{{ round($analysis2->x2, 4) }}</td>
                    </tr>
                    <tr class="border-b">
                        <td class="font-semibold p-2">X3:</td>
                        <td class="p-2">{{ round($analysis2->x3, 4) }}</td>
                    </tr>
                    <tr class="border-b">
                        <td class="font-semibold p-2">X4:</td>
                        <td class="p-2">{{ round($analysis2->x4, 4) }}</td>
                    </tr>
                    <tr>
                        <td class="font-semibold p-2">X5:</td>
                        <td class="p-2">{{ round($analysis2->x5, 4) }}</td>
                    </tr>
                </table>
            </div>
        </div>

        <div class="mt-8">
            <a href="{{ route('history.index') }}" class="bg-blue-500 text-white px-6 py-2 rounded hover:bg-blue-600">
                Back to History
            </a>
        </div>
    </div>
</div>
@endsection