@extends('layouts.app')

@section('content')
<div class="container-fluid page-wrapper">
    <div class="row justify-content-center">
        <div class="col-lg-11 col-xl-10">
            <div class="form-card card">
                <div class="card-body">
                    <div class="section-wrapper">
                        <div class="section-header">
                            <div class="icon-wrapper">
                                <i class="fas fa-chart-line"></i>
                            </div>
                            <h5>Financial Reports</h5>
                        </div>

                        <!-- Financial Summary Cards -->
                        <div class="row mb-4">
                            <div class="col-md-3 mb-3">
                                <div class="metric-card">
                                    <div class="metric-icon">
                                        <i class="fas fa-hand-holding-usd"></i>
                                    </div>
                                    <div class="metric-content">
                                        <h6>Total Loans</h6>
                                        <h4>KES {{ number_format($totalLoans, 2) }}</h4>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-3 mb-3">
                                <div class="metric-card">
                                    <div class="metric-icon">
                                        <i class="fas fa-piggy-bank"></i>
                                    </div>
                                    <div class="metric-content">
                                        <h6>Total Savings</h6>
                                        <h4>KES {{ number_format($totalSavings, 2) }}</h4>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-3 mb-3">
                                <div class="metric-card">
                                    <div class="metric-icon">
                                        <i class="fas fa-check-circle"></i>
                                    </div>
                                    <div class="metric-content">
                                        <h6>Active Loans</h6>
                                        <h4>{{ $activeLoans }}</h4>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-3 mb-3">
                                <div class="metric-card">
                                    <div class="metric-icon">
                                        <i class="fas fa-users"></i>
                                    </div>
                                    <div class="metric-content">
                                        <h6>Active Clients</h6>
                                        <h4>{{ $activeClients }}</h4>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <!-- Print Reports Section -->
                        <div class="section-wrapper">
                            <div class="section-header">
                                <div class="icon-wrapper">
                                    <i class="fas fa-print"></i>
                                </div>
                                <h5>Print Financial Reports</h5>
                            </div>

                            <div class="row">
                                <div class="col-md-4 mb-3">
                                    <button class="btn btn-primary w-100">
                                        <i class="fas fa-print"></i> Print Balance Sheet
                                    </button>
                                </div>
                                <div class="col-md-4 mb-3">
                                    <button class="btn btn-success w-100">
                                        <i class="fas fa-print"></i> Print Income Statement
                                    </button>
                                </div>
                                <div class="col-md-4 mb-3">
                                    <button class="btn btn-info w-100">
                                        <i class="fas fa-print"></i> Print Cash Flow
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<style>
    :root {
        --primary-green: #10b981;
        --primary-green-dark: #059669;
        --accent-yellow: #fbbf24;
        --accent-yellow-light: #fef3c7;
        --success-green: #34d399;
        --white: #ffffff;
        --gray-50: #f9fafb;
        --gray-100: #f3f4f6;
        --gray-200: #e5e7eb;
        --gray-300: #d1d5db;
        --gray-600: #4b5563;
        --gray-700: #374151;
        --gray-900: #111827;
        --danger: #ef4444;
    }

    .page-wrapper {
        padding: 2rem 0;
    }

    .form-card {
        background: white;
        border-radius: 20px;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
        border: none;
        overflow: hidden;
    }

    .form-card .card-body {
        padding: 2.5rem;
    }

    .section-wrapper {
        background: var(--gray-50);
        padding: 1.75rem;
        border-radius: 14px;
        margin-bottom: 1.75rem;
        border: 2px solid var(--gray-200);
        transition: all 0.3s ease;
    }

    .section-wrapper:hover {
        border-color: var(--primary-green);
        box-shadow: 0 6px 20px rgba(16, 185, 129, 0.12);
    }

    .section-header {
        display: flex;
        align-items: center;
        margin-bottom: 1.5rem;
        padding-bottom: 0.75rem;
        border-bottom: 3px solid transparent;
        background: linear-gradient(90deg, var(--primary-green) 0%, var(--accent-yellow) 100%);
        background-clip: text;
        -webkit-background-clip: text;
        border-image: linear-gradient(90deg, var(--primary-green) 0%, var(--accent-yellow) 100%);
        border-image-slice: 1;
        border-bottom: 3px solid;
    }

    .section-header h5 {
        margin: 0;
        font-weight: 700;
        font-size: 1.1rem;
        color: var(--primary-green);
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }

    .section-header .icon-wrapper {
        width: 36px;
        height: 36px;
        background: linear-gradient(135deg, var(--primary-green) 0%, var(--success-green) 100%);
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 1rem;
    }

    .metric-card {
        background: white;
        border-radius: 12px;
        padding: 1.5rem;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
        border: 2px solid var(--gray-200);
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .metric-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
        border-color: var(--primary-green);
    }

    .metric-icon {
        width: 50px;
        height: 50px;
        background: linear-gradient(135deg, var(--primary-green) 0%, var(--success-green) 100%);
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 1.2rem;
    }

    .metric-content h6 {
        margin: 0 0 0.25rem 0;
        font-weight: 600;
        color: var(--gray-700);
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .metric-content h4 {
        margin: 0;
        font-weight: 800;
        color: var(--primary-green);
        font-size: 1.25rem;
    }

    .btn-primary {
        background: linear-gradient(135deg, var(--primary-green) 0%, var(--success-green) 100%);
        border: none;
        color: white;
        padding: 0.75rem 1.5rem;
        border-radius: 10px;
        font-weight: 600;
        font-size: 0.9rem;
        transition: all 0.3s ease;
        box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
    }

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
        color: white;
    }

    .btn-success {
        background: linear-gradient(135deg, var(--success-green) 0%, var(--primary-green) 100%);
        border: none;
        color: white;
        padding: 0.75rem 1.5rem;
        border-radius: 10px;
        font-weight: 600;
        font-size: 0.9rem;
        transition: all 0.3s ease;
        box-shadow: 0 4px 15px rgba(52, 211, 153, 0.2);
    }

    .btn-success:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(52, 211, 153, 0.3);
        color: white;
    }

    .btn-info {
        background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
        border: none;
        color: white;
        padding: 0.75rem 1.5rem;
        border-radius: 10px;
        font-weight: 600;
        font-size: 0.9rem;
        transition: all 0.3s ease;
        box-shadow: 0 4px 15px rgba(14, 165, 233, 0.2);
    }

    .btn-info:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(14, 165, 233, 0.3);
        color: white;
    }

    @media (max-width: 768px) {
        .form-card .card-body {
            padding: 1.5rem;
        }

        .section-wrapper {
            padding: 1.25rem;
        }

        .metric-card {
            padding: 1rem;
        }

        .metric-content h4 {
            font-size: 1.1rem;
        }
    }
</style>
@endsection
