@extends('layouts.app')

@section('title', __('accounts.cash_box.title'))

@push('styles')
<link href="{{ asset('css/stage-academy.css') }}" rel="stylesheet">
<link href="{{ asset('css/accounts.css') }}" rel="stylesheet">
<style>
    .balance-card {
        border-radius: 16px;
    }

    .balance-amount {
        font-size: clamp(1.6rem, 3vw, 2.4rem);
        letter-spacing: 0.2px;
    }

    .balance-chip {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        padding: 0.35rem 0.6rem;
        border-radius: 999px;
        background: rgba(13, 110, 253, 0.08);
        border: 1px solid rgba(13, 110, 253, 0.14);
        color: #0d6efd;
        font-size: 0.85rem;
    }

    body.dark-mode .balance-chip {
        background: rgba(59, 130, 246, 0.16);
        border-color: rgba(59, 130, 246, 0.28);
        color: #93c5fd;
    }

    body.dark-mode .balance-card {
        border-color: #334155;
    }
</style>
@endpush

@section('content')
<div class="container-fluid">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <div>
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb mb-1">
                    <li class="breadcrumb-item"><a href="{{ route('dashboard') }}">{{ __('dashboard') }}</a></li>
                    <li class="breadcrumb-item"><a href="{{ route('accounts') }}">{{ __('accounts.title') }}</a></li>
                    <li class="breadcrumb-item active" aria-current="page">{{ __('accounts.cash_box.title') }}</li>
                </ol>
            </nav>
            <h4 class="fw-bold mb-0">{{ __('accounts.cash_box.title') }}</h4>
        </div>
        <a href="{{ route('accounts') }}" class="btn btn-outline-secondary">
            <i class="bi bi-arrow-{{ app()->getLocale() == 'ar' ? 'right' : 'left' }}"></i> {{ __('common.back') }}
        </a>
    </div>

    <div class="card sa-card border-0 shadow-sm balance-card">
        <div class="card-body p-4 p-lg-5">
            <div class="d-flex align-items-start justify-content-between gap-3">
                <div>
                    <div class="balance-chip mb-3">
                        <i class="bi bi-safe"></i>
                        <span>{{ __('accounts.current_balance') }}</span>
                    </div>
                    <div class="text-muted small mb-1">{{ __('accounts.available_amount') }}</div>
                    <div class="balance-amount fw-bold">{{ number_format((int) $balance, 0) }}</div>
                </div>
                <div class="text-end">
                    <div class="text-muted small">{{ __('accounts.box_breakdown.title') }}</div>
                    <div class="small mt-2">
                        <div class="d-flex justify-content-between gap-3">
                            <span class="text-muted">{{ __('accounts.box_breakdown.incoming') }}</span>
                            <span class="fw-semibold">{{ number_format((int) $incoming_total, 0) }}</span>
                        </div>
                        <div class="d-flex justify-content-between gap-3">
                            <span class="text-muted">{{ __('accounts.box_breakdown.expenses') }}</span>
                            <span class="fw-semibold">{{ number_format((int) $expenses_total, 0) }}</span>
                        </div>
                        <div class="d-flex justify-content-between gap-3">
                            <span class="text-muted">{{ __('accounts.box_breakdown.transfers_net') }}</span>
                            <span class="fw-semibold">{{ number_format((int) ($transfers_in - $transfers_out), 0) }}</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
