<li class="mt-2 tree-item" data-account-id="{{ $account->id }}" data-account-code="{{ $account->code }}" data-account-name="{{ $account->name }}">
    <div class="flex items-center">
        @if ($account->children && $account->children->count() > 0)
            <button class="toggle-btn mr-2 p-1 hover:bg-gray-100 rounded transition-colors duration-150" data-account-id="{{ $account->id }}" title="{{ \App\Helpers\TranslationHelper::transFromDatabase('Toggle', __('Toggle')) }}">
                <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-600 transition-transform duration-200 transform" viewBox="0 0 20 20" fill="currentColor" style="transform: rotate(-90deg);">
                    <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
                </svg>
            </button>
        @else
            <div class="mr-2 p-1 w-8"></div>
        @endif
        
        <div class="flex-shrink-0">
            @if ($account->is_parent)
                <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-blue-500" viewBox="0 0 20 20" fill="currentColor">
                    <path d="M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z" />
                </svg>
            @else
                <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-500" viewBox="0 0 20 20" fill="currentColor">
                    <path fill-rule="evenodd" d="M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z" clip-rule="evenodd" />
                </svg>
            @endif
        </div>
        <div class="mr-3 flex-grow">
            <div class="text-sm font-medium text-gray-900">
                <a href="{{ route('accounting.chart-of-accounts.show', $account) }}" class="hover:underline">
                    <span class="account-code">{{ $account->code }}</span> - <span class="account-name">{{ $account->name }}</span>
                </a>
                @if (!$account->is_active)
                    <span class="inline-flex items-center p-2.5 py-0.5 rounded-full text-s font-medium bg-red-100 text-red-800 mr-2">
                        {{ \App\Helpers\TranslationHelper::transFromDatabase('Inactive', __('Inactive')) }}
                    </span>
                @endif
            </div>
            <div class="text-s text-gray-500">
                @switch($account->account_type)
                    @case('asset')
                        {{ \App\Helpers\TranslationHelper::transFromDatabase('Assets', __('Assets')) }}
                        @break
                    @case('liability')
                        {{ \App\Helpers\TranslationHelper::transFromDatabase('Liabilities', __('Liabilities')) }}
                        @break
                    @case('equity')
                        {{ \App\Helpers\TranslationHelper::transFromDatabase('Equity', __('Equity')) }}
                        @break
                    @case('revenue')
                        {{ \App\Helpers\TranslationHelper::transFromDatabase('Revenue', __('Revenue')) }}
                        @break
                    @case('expense')
                        {{ \App\Helpers\TranslationHelper::transFromDatabase('Expenses', __('Expenses')) }}
                        @break
                    @default
                        {{ $account->account_type }}
                @endswitch
                -
                @if ($account->balance_type == 'debit')
                    {{ \App\Helpers\TranslationHelper::transFromDatabase('Debit', __('Debit')) }}
                @else
                    {{ \App\Helpers\TranslationHelper::transFromDatabase('Credit', __('Credit')) }}
                @endif
            </div>
        </div>
    </div>

    @if ($account->children && $account->children->count() > 0)
        <ul class="children-container mt-2 space-y-2 mr-6 border-r-2 border-gray-200 pr-4" id="children-{{ $account->id }}" style="display: block;">
            @foreach ($account->children as $child)
                @include('accounting.chart-of-accounts.partials.account-tree-item', ['account' => $child])
            @endforeach
        </ul>
    @endif
</li>