@extends('layouts.app')

@section('content')
<div class="min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 py-12 px-4 md:px-8">
    <div class="max-w-7xl mx-auto">
        <!-- Header -->
        <div class="mb-8">
            <h1 class="text-4xl font-bold text-gray-900">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard', __('Dashboard')) }}</h1>
            <p class="text-gray-600 mt-2">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.WelcomeMessage', __('Welcome to the Maadalah system for commercial and service activities')) }}</p>
        </div>

        <!-- New Member Alert - Create Company -->
        @if(Auth::user()->isNewMemberWithoutCompany())
        <div class="bg-gradient-to-r from-amber-50 to-orange-50 border-l-4 border-orange-500 p-6 mb-8 rounded-r-lg shadow-md">
            <div class="flex items-start gap-4">
                <div class="flex-shrink-0">
                    <i class="fas fa-building text-orange-500 text-2xl"></i>
                </div>
                <div class="flex-1">
                    <h3 class="text-lg font-bold text-orange-900 mb-2">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.CreateCompanyTitle', __('Create your company')) }}</h3>
                    <p class="text-orange-800 mb-4">
                        {{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.CreateCompanyDescription', __('Welcome! You have registered successfully, but you need to create your company first to be able to access all the features of the system.')) }}
                    </p>
                    <div class="flex flex-wrap gap-3">
                        <a href="{{ route('company.create') }}" class="inline-flex items-center px-6 py-3 bg-gradient-to-r from-orange-600 to-orange-700 text-white font-semibold rounded-lg hover:from-orange-700 hover:to-orange-800 transition-all duration-200 shadow-lg hover:shadow-xl transform hover:scale-105">
                            <i class="fas fa-plus ml-2"></i>
                            {{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.CreateCompanyButton', __('Create new company')) }}
                        </a>
                        <button type="button" onclick="document.getElementById('companyInfo').classList.toggle('hidden')" class="inline-flex items-center px-6 py-3 bg-white text-orange-600 font-semibold rounded-lg hover:bg-gray-100 transition-all duration-200 border border-orange-200">
                            <i class="fas fa-question-circle ml-2"></i>
                            {{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.MoreInfoButton', __('More information')) }}
                        </button>
                    </div>
                </div>
            </div>

            <!-- Collapsible Info -->
            <div id="companyInfo" class="hidden mt-4 pt-4 border-t border-orange-200">
                <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                    <div class="flex gap-3">
                        <div class="flex-shrink-0 text-orange-500 mt-1">
                            <i class="fas fa-check-circle"></i>
                        </div>
                        <div>
                            <h4 class="font-semibold text-orange-900">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.FullPermissions', __('Full Permissions')) }}</h4>
                            <p class="text-sm text-orange-800">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.FullPermissionsDesc', __('You will become the owner of the company with all permissions')) }}</p>
                        </div>
                    </div>
                    <div class="flex gap-3">
                        <div class="flex-shrink-0 text-orange-500 mt-1">
                            <i class="fas fa-users"></i>
                        </div>
                        <div>
                            <h4 class="font-semibold text-orange-900">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.AddTeam', __('Add Team')) }}</h4>
                            <p class="text-sm text-orange-800">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.AddTeamDesc', __('You can add employees later')) }}</p>
                        </div>
                    </div>
                    <div class="flex gap-3">
                        <div class="flex-shrink-0 text-orange-500 mt-1">
                            <i class="fas fa-lock"></i>
                        </div>
                        <div>
                            <h4 class="font-semibold text-orange-900">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.DataProtection', __('Data Protection')) }}</h4>
                            <p class="text-sm text-orange-800">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.DataProtectionDesc', __('Safe and protected data')) }}</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        @endif

        <!-- User Info -->
        @if(!Auth::user()->isNewMemberWithoutCompany())
        <div class="bg-white rounded-xl shadow-lg border border-gray-200 overflow-hidden mb-8 p-6">
            <div class="flex items-center gap-6">
                <div class="bg-gradient-to-br from-blue-100 to-blue-200 rounded-full p-4 w-16 h-16 flex items-center justify-center">
                    <i class="fas fa-user text-blue-600 text-2xl"></i>
                </div>
                <div>
                    <h2 class="text-2xl font-bold text-gray-900">{{ Auth::user()->name }}</h2>
                    <p class="text-gray-600">{{ Auth::user()->email }}</p>
                    @if(Auth::user()->company)
                    <p class="text-blue-600 font-medium mt-1">
                        <i class="fas fa-building ml-1"></i>
                        {{ Auth::user()->company->name }}
                    </p>
                    @endif
                </div>
            </div>
        </div>
        @endif

        <!-- Quick Stats -->
        @if(!Auth::user()->isNewMemberWithoutCompany())
        <div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-8">
            <div class="bg-white rounded-xl shadow-lg border border-gray-200 p-6 hover:shadow-xl transition-all">
                <div class="flex items-center justify-between">
                    <div>
                        <p class="text-gray-600 text-sm">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.ActiveCustomersCount', __('Active Customers')) }}</p>
                        <h3 class="text-3xl font-bold text-gray-900">12</h3>
                    </div>
                    <div class="bg-blue-100 rounded-full p-3">
                        <i class="fas fa-users text-blue-600 text-xl"></i>
                    </div>
                </div>
            </div>

            <div class="bg-white rounded-xl shadow-lg border border-gray-200 p-6 hover:shadow-xl transition-all">
                <div class="flex items-center justify-between">
                    <div>
                        <p class="text-gray-600 text-sm">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.DailySales', __('Daily Sales')) }}</p>
                        <h3 class="text-3xl font-bold text-gray-900">48</h3>
                    </div>
                    <div class="bg-green-100 rounded-full p-3">
                        <i class="fas fa-shopping-cart text-green-600 text-xl"></i>
                    </div>
                </div>
            </div>

            <div class="bg-white rounded-xl shadow-lg border border-gray-200 p-6 hover:shadow-xl transition-all">
                <div class="flex items-center justify-between">
                    <div>
                        <p class="text-gray-600 text-sm">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.RevenueStats', __('Revenue (SAR)')) }}</p>
                        <h3 class="text-3xl font-bold text-gray-900">1.2M</h3>
                    </div>
                    <div class="bg-purple-100 rounded-full p-3">
                        <i class="fas fa-coins text-purple-600 text-xl"></i>
                    </div>
                </div>
            </div>

            <div class="bg-white rounded-xl shadow-lg border border-gray-200 p-6 hover:shadow-xl transition-all">
                <div class="flex items-center justify-between">
                    <div>
                        <p class="text-gray-600 text-sm">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.PendingTasks', __('Pending Tasks')) }}</p>
                        <h3 class="text-3xl font-bold text-gray-900">7</h3>
                    </div>
                    <div class="bg-red-100 rounded-full p-3">
                        <i class="fas fa-tasks text-red-600 text-xl"></i>
                    </div>
                </div>
            </div>
        </div>

        <!-- Quick Links -->
        <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
            <div class="bg-white rounded-xl shadow-lg border border-gray-200 p-6 hover:shadow-xl transition-all">
                <div class="flex items-start gap-4">
                    <div class="bg-blue-100 rounded-lg p-3">
                        <i class="fas fa-shopping-cart text-blue-600 text-xl"></i>
                    </div>
                    <div>
                        <h3 class="text-lg font-bold text-gray-900 mb-2">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.SalesManagement', __('Sales Management')) }}</h3>
                        <p class="text-gray-600 text-sm mb-4">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.SalesManagementDesc', __('Manage customer invoices and follow up on sales and services')) }}</p>
                        <a href="{{ route('customer-invoices.index') }}" class="text-blue-600 hover:text-blue-700 font-medium text-sm">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.ViewInvoices', __('View Invoices')) }} ←</a>
                    </div>
                </div>
            </div>

            <div class="bg-white rounded-xl shadow-lg border border-gray-200 p-6 hover:shadow-xl transition-all">
                <div class="flex items-start gap-4">
                    <div class="bg-green-100 rounded-lg p-3">
                        <i class="fas fa-users text-green-600 text-xl"></i>
                    </div>
                    <div>
                        <h3 class="text-lg font-bold text-gray-900 mb-2">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.HRManagement', __('Human Resources')) }}</h3>
                        <p class="text-gray-600 text-sm mb-4">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.HRManagementDesc', __('Manage employees, payroll and leaves')) }}</p>
                        <a href="#" class="text-green-600 hover:text-green-700 font-medium text-sm">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.ManageEmployees', __('Manage Employees')) }} ←</a>
                    </div>
                </div>
            </div>

            <div class="bg-white rounded-xl shadow-lg border border-gray-200 p-6 hover:shadow-xl transition-all">
                <div class="flex items-start gap-4">
                    <div class="bg-purple-100 rounded-lg p-3">
                        <i class="fas fa-chart-line text-purple-600 text-xl"></i>
                    </div>
                    <div>
                        <h3 class="text-lg font-bold text-gray-900 mb-2">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.FinanceAccounting', __('Finance and Accounting')) }}</h3>
                        <p class="text-gray-600 text-sm mb-4">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.FinanceAccountingDesc', __('Manage accounts, invoices and reports')) }}</p>
                        <a href="#" class="text-purple-600 hover:text-purple-700 font-medium text-sm">{{ \App\Helpers\TranslationHelper::transFromDatabase('Dashboard.ViewReports', __('View Reports')) }} ←</a>
                    </div>
                </div>
            </div>
        </div>
        @endif
    </div>
</div>
@endsection
