<?php $__env->startSection('page-title', 'Transactions'); ?>

<?php $__env->startPush('styles'); ?>
<style>
    /* =============================================
       CSS CUSTOM PROPERTIES
    ============================================= */
    :root {
        --radius-xl: 20px;
        --radius-lg: 16px;
        --radius-md: 12px;
        --radius-sm: 8px;
        --shadow-sm: 0 2px 12px rgba(0,0,0,0.06);
        --shadow-md: 0 8px 32px rgba(0,0,0,0.10);
        --shadow-hover: 0 16px 48px rgba(0,0,0,0.13);
        --transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        --color-income:  #11998e;
        --color-expense: #eb3349;
        --color-primary: #667eea;
    }

    /* =============================================
       PAGE WRAPPER
    ============================================= */
    .transactions-page {
        padding: 4px 0 28px;
    }

    /* =============================================
       PAGE HEADER
    ============================================= */
    .page-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 12px;
        margin-bottom: 20px;
    }

    .page-header h2 {
        font-size: clamp(1.2rem, 3vw, 1.65rem);
        font-weight: 700;
        color: #1a1a2e;
        margin: 0;
    }

    .header-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }

    /* =============================================
       BUTTONS
    ============================================= */
    .btn {
        border-radius: var(--radius-md);
        padding: 9px 18px;
        font-weight: 600;
        font-size: 0.88rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        border: none;
        text-decoration: none;
        transition: var(--transition);
        cursor: pointer;
        white-space: nowrap;
    }

    .btn:hover { transform: translateY(-2px); }

    .btn-primary {
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: #fff;
        box-shadow: 0 4px 12px rgba(102,126,234,0.35);
    }

    .btn-secondary {
        background: #f1f5f9;
        color: #475569;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }

    .btn-secondary:hover { background: #e2e8f0; color: #334155; }

    .btn-sm {
        padding: 6px 12px;
        font-size: 0.8rem;
        border-radius: var(--radius-sm);
    }

    .btn-info {
        background: linear-gradient(135deg, #06b6d4, #4facfe);
        color: #fff;
        box-shadow: 0 3px 10px rgba(6,182,212,0.3);
    }

    .btn-w-full { width: 100%; }

    /* =============================================
       SUMMARY CARDS
    ============================================= */
    .summary-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        margin-bottom: 20px;
    }

    .summary-card {
        border-radius: var(--radius-lg);
        padding: 20px 22px;
        color: #fff;
        box-shadow: var(--shadow-md);
        transition: var(--transition);
        position: relative;
        overflow: hidden;
        border: none;
    }

    .summary-card::after {
        content: '';
        position: absolute;
        top: -30%;
        right: -10%;
        width: 120px;
        height: 120px;
        border-radius: 50%;
        background: rgba(255,255,255,0.1);
        pointer-events: none;
    }

    .summary-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

    .summary-card.income  { background: linear-gradient(135deg, #11998e, #38ef7d); }
    .summary-card.expense { background: linear-gradient(135deg, #eb3349, #f45c43); }

    .summary-card h5 {
        font-size: 0.85rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        opacity: 0.9;
        margin-bottom: 8px;
    }

    .summary-card h3 {
        font-size: clamp(1.3rem, 3.5vw, 1.9rem);
        font-weight: 800;
        margin: 0;
        word-break: break-all;
    }

    .summary-card .summary-icon {
        position: absolute;
        bottom: 12px;
        right: 18px;
        font-size: 2.2rem;
        opacity: 0.2;
    }

    /* =============================================
       FILTER CARD
    ============================================= */
    .filter-card {
        background: #fff;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
        border: none;
        margin-bottom: 20px;
        overflow: hidden;
    }

    .filter-card .card-body {
        padding: 18px 20px;
    }

    .filter-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr) auto auto;
        gap: 12px;
        align-items: end;
    }

    .form-group { display: flex; flex-direction: column; gap: 6px; }

    .form-label {
        font-size: 0.8rem;
        font-weight: 600;
        color: #475569;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        margin: 0;
    }

    .form-control,
    .form-select {
        border-radius: var(--radius-md);
        border: 2px solid #e2e8f0;
        padding: 9px 13px;
        font-size: 0.88rem;
        font-weight: 500;
        color: #334155;
        background: #fff;
        transition: var(--transition);
        width: 100%;
        appearance: none;
        -webkit-appearance: none;
    }

    .form-control:focus,
    .form-select:focus {
        border-color: var(--color-primary);
        box-shadow: 0 0 0 4px rgba(102,126,234,0.15);
        outline: none;
    }

    .form-select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        padding-right: 32px;
    }

    /* =============================================
       TRANSACTIONS TABLE CARD
    ============================================= */
    .table-card {
        background: #fff;
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-sm);
        border: none;
        overflow: hidden;
    }

    .table-card .card-body { padding: 0; }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table { width: 100%; border-collapse: collapse; }

    thead th {
        background: #f8fafc;
        padding: 14px 16px;
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #64748b;
        border-bottom: 2px solid #e2e8f0;
        white-space: nowrap;
    }

    tbody td {
        padding: 14px 16px;
        font-size: 0.88rem;
        font-weight: 500;
        color: #334155;
        border-bottom: 1px solid #f1f5f9;
        vertical-align: middle;
    }

    tbody tr {
        transition: var(--transition);
        cursor: pointer;
    }

    tbody tr:hover { background: linear-gradient(135deg, rgba(102,126,234,0.04), rgba(118,75,162,0.04)); }

    tbody tr:last-child td { border-bottom: none; }

    /* =============================================
       BADGES
    ============================================= */
    .badge {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 5px 12px;
        border-radius: 20px;
        font-size: 0.75rem;
        font-weight: 700;
        white-space: nowrap;
    }

    .badge-income  { background: rgba(17,153,142,0.12); color: var(--color-income); }
    .badge-expense { background: rgba(235,51,73,0.12);  color: var(--color-expense); }

    /* =============================================
       AMOUNT CELLS
    ============================================= */
    .amount-income  { color: var(--color-income);  font-weight: 700; }
    .amount-expense { color: var(--color-expense); font-weight: 700; }

    /* =============================================
       PAYMENT METHOD PILL
    ============================================= */
    .method-pill {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        padding: 4px 10px;
        border-radius: 20px;
        font-size: 0.75rem;
        font-weight: 600;
        background: #f1f5f9;
        color: #475569;
        white-space: nowrap;
    }

    /* =============================================
       DETAILS CELL
    ============================================= */
    .details-cell {
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: #64748b;
        font-size: 0.83rem;
    }

    /* =============================================
       EMPTY STATE
    ============================================= */
    .empty-state {
        text-align: center;
        padding: 60px 20px;
        color: #94a3b8;
    }

    .empty-state i { display: block; margin-bottom: 16px; opacity: 0.4; }
    .empty-state p { font-size: 0.9rem; margin-bottom: 20px; }

    /* =============================================
       PAGINATION WRAPPER
    ============================================= */
    .pagination-wrapper {
        padding: 16px 20px;
        border-top: 1px solid #f1f5f9;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }

    /* =============================================
       MOBILE CARDS VIEW (replaces table on small screens)
    ============================================= */
    .tx-card-list { display: none; padding: 12px; }

    .tx-card {
        background: #fafafa;
        border: 1px solid #f1f5f9;
        border-radius: var(--radius-md);
        padding: 14px 16px;
        margin-bottom: 10px;
        transition: var(--transition);
        position: relative;
        border-left: 4px solid transparent;
    }

    .tx-card.income-card  { border-left-color: var(--color-income); }
    .tx-card.expense-card { border-left-color: var(--color-expense); }

    .tx-card:hover { background: #f1f5f9; }

    .tx-card-top {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 10px;
    }

    .tx-card-left { min-width: 0; flex: 1; }

    .tx-card-date {
        font-size: 0.75rem;
        color: #94a3b8;
        font-weight: 500;
        margin-bottom: 3px;
    }

    .tx-card-details {
        font-size: 0.9rem;
        font-weight: 600;
        color: #1a1a2e;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .tx-card-amount {
        font-size: 1.1rem;
        font-weight: 800;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .tx-card-amount.income  { color: var(--color-income); }
    .tx-card-amount.expense { color: var(--color-expense); }

    .tx-card-bottom {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        flex-wrap: wrap;
    }

    .tx-card-meta {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

    /* =============================================
       ============================================
       RESPONSIVE BREAKPOINTS
       ============================================
    ============================================= */

    /* ---- EXTRA SMALL < 480px ---- */
    @media (max-width: 479px) {
        .transactions-page { padding: 0 0 16px; }

        .page-header { flex-direction: column; align-items: stretch; }
        .page-header h2 { font-size: 1.2rem; }

        .header-actions {
            display: grid;
            grid-template-columns: 1fr 1fr;
        }

        .header-actions .btn:last-child {
            grid-column: 1 / -1;
        }

        .summary-row { gap: 10px; }
        .summary-card { padding: 14px 16px; }
        .summary-card h3 { font-size: 1.2rem; }
        .summary-card .summary-icon { font-size: 1.6rem; }

        /* Filter: stack 1 col */
        .filter-grid {
            grid-template-columns: 1fr;
            gap: 10px;
        }

        .filter-card .card-body { padding: 14px; }

        /* Hide table, show card list */
        .table-responsive { display: none; }
        .tx-card-list { display: block; }

        .pagination-wrapper { padding: 12px 14px; }
    }

    /* ---- SMALL 480–575px ---- */
    @media (min-width: 480px) and (max-width: 575px) {
        .page-header { flex-direction: column; align-items: stretch; }

        .header-actions {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
        }

        .summary-row { gap: 12px; }
        .summary-card h3 { font-size: 1.3rem; }

        /* Filter: 2 col */
        .filter-grid {
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        .filter-actions-row {
            grid-column: 1 / -1;
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        /* Hide table, show card list */
        .table-responsive { display: none; }
        .tx-card-list { display: block; }
    }

    /* ---- MEDIUM 576–767px ---- */
    @media (min-width: 576px) and (max-width: 767px) {
        .filter-grid {
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }

        .filter-actions-row {
            grid-column: 1 / -1;
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }

        /* Table visible but compact */
        .details-cell { max-width: 100px; }
        thead th, tbody td { padding: 11px 10px; font-size: 0.82rem; }
    }

    /* ---- TABLET 768–991px ---- */
    @media (min-width: 768px) and (max-width: 991px) {
        .filter-grid {
            grid-template-columns: 1fr 1fr 1fr;
            gap: 12px;
        }

        .filter-actions-row {
            grid-column: 1 / -1;
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }
    }

    /* ---- DESKTOP 992px+ ---- */
    @media (min-width: 992px) {
        .filter-grid {
            grid-template-columns: repeat(4, 1fr) auto auto;
        }

        .filter-actions-row { display: contents; }
    }

    /* =============================================
       TOUCH OPTIMISATIONS
    ============================================= */
    @media (hover: none) and (pointer: coarse) {
        .btn:hover           { transform: none; }
        .summary-card:hover  { transform: none; }
        tbody tr:hover       { background: transparent; }
        .tx-card:hover       { background: #fafafa; }
        .btn { padding: 11px 18px; }
        thead th, tbody td { padding: 14px 12px; }
    }

    /* =============================================
       ACCESSIBILITY
    ============================================= */
    @media (prefers-reduced-motion: reduce) {
        *, *::before, *::after {
            transition-duration: 0.01ms !important;
            animation-duration: 0.01ms !important;
        }
    }

    :focus-visible {
        outline: 3px solid #667eea;
        outline-offset: 2px;
        border-radius: 4px;
    }

    /* =============================================
       PRINT
    ============================================= */
    @media print {
        .page-header .header-actions,
        .filter-card,
        .tx-card-list { display: none !important; }

        .table-responsive { display: block !important; overflow: visible !important; }
        .table-card { box-shadow: none !important; border: 1px solid #ccc !important; }
        thead th, tbody td { padding: 8px 10px !important; font-size: 0.8rem !important; }
        .summary-card { box-shadow: none !important; -webkit-print-color-adjust: exact; }
    }
</style>
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
<div class="transactions-page">

    
    <div class="page-header">
        <h2>Transactions</h2>
        <div class="header-actions">
            <a href="<?php echo e(route('transactions.print')); ?>" class="btn btn-secondary">
                <i class="fas fa-print"></i> Print
            </a>
            <a href="<?php echo e(route('transactions.create')); ?>" class="btn btn-primary">
                <i class="fas fa-plus"></i> Add Transaction
            </a>
            <a href="<?php echo e(route('accounts.all')); ?>" class="btn btn-secondary">
                <i class="fas fa-arrow-left"></i> Back
            </a>
        </div>
    </div>

    
    <div class="summary-row">
        <div class="summary-card income">
            <h5>Total Income</h5>
            <h3>৳<?php echo e(number_format($totalIncome, 2)); ?></h3>
            <i class="fas fa-arrow-up summary-icon"></i>
        </div>
        <div class="summary-card expense">
            <h5>Total Expenses</h5>
            <h3>৳<?php echo e(number_format($totalExpense, 2)); ?></h3>
            <i class="fas fa-arrow-down summary-icon"></i>
        </div>
    </div>

    
    <div class="filter-card">
        <div class="card-body">
            <form method="GET" action="<?php echo e(route('transactions.index')); ?>">
                <div class="filter-grid">

                    <div class="form-group">
                        <label for="from_date" class="form-label">From Date</label>
                        <input type="date" class="form-control" id="from_date" name="from_date"
                               value="<?php echo e(request('from_date')); ?>">
                    </div>

                    <div class="form-group">
                        <label for="to_date" class="form-label">To Date</label>
                        <input type="date" class="form-control" id="to_date" name="to_date"
                               value="<?php echo e(request('to_date')); ?>">
                    </div>

                    <div class="form-group">
                        <label for="type" class="form-label">Type</label>
                        <select class="form-select" id="type" name="type">
                            <option value="">All</option>
                            <option value="income"  <?php echo e(request('type') == 'income'  ? 'selected' : ''); ?>>Income</option>
                            <option value="expense" <?php echo e(request('type') == 'expense' ? 'selected' : ''); ?>>Expense</option>
                        </select>
                    </div>

                    <div class="form-group">
                        <label for="payment_method" class="form-label">Payment Method</label>
                        <select class="form-select" id="payment_method" name="payment_method">
                            <option value="">All</option>
                            <option value="cash"    <?php echo e(request('payment_method') == 'cash'    ? 'selected' : ''); ?>>Cash</option>
                            <option value="bank"    <?php echo e(request('payment_method') == 'bank'    ? 'selected' : ''); ?>>Bank</option>
                            <option value="digital" <?php echo e(request('payment_method') == 'digital' ? 'selected' : ''); ?>>Digital</option>
                        </select>
                    </div>

                    
                    <div class="filter-actions-row">
                        <div class="form-group">
                            <button type="submit" class="btn btn-primary btn-w-full">
                                <i class="fas fa-filter"></i> Filter
                            </button>
                        </div>
                        <div class="form-group">
                            <a href="<?php echo e(route('transactions.index')); ?>" class="btn btn-secondary btn-w-full">
                                <i class="fas fa-redo"></i> Reset
                            </a>
                        </div>
                    </div>

                </div>
            </form>
        </div>
    </div>

    
    <div class="table-card">
        <div class="card-body">

            
            <div class="table-responsive">
                <table>
                    <thead>
                        <tr>
                            <th>Date</th>
                            <th>Type</th>
                            <th>Amount</th>
                            <th>Method</th>
                            <th>Details</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__empty_1 = true; $__currentLoopData = $transactions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transaction): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <tr>
                                <td style="white-space:nowrap;">
                                    <?php echo e($transaction->date->format('M d, Y')); ?>

                                </td>
                                <td>
                                    <span class="badge <?php echo e($transaction->type == 'income' ? 'badge-income' : 'badge-expense'); ?>">
                                        <?php if($transaction->type == 'income'): ?>
                                            <i class="fas fa-arrow-up" style="font-size:0.65rem;"></i>
                                        <?php else: ?>
                                            <i class="fas fa-arrow-down" style="font-size:0.65rem;"></i>
                                        <?php endif; ?>
                                        <?php echo e(ucfirst($transaction->type)); ?>

                                    </span>
                                </td>
                                <td class="amount-<?php echo e($transaction->type); ?>">
                                    <?php echo e($transaction->type == 'income' ? '+' : '−'); ?>৳<?php echo e(number_format($transaction->amount, 2)); ?>

                                </td>
                                <td>
                                    <span class="method-pill">
                                        <?php if($transaction->payment_method == 'cash'): ?>
                                            <i class="fas fa-money-bill-wave" style="font-size:0.72rem;"></i>
                                        <?php elseif($transaction->payment_method == 'bank'): ?>
                                            <i class="fas fa-university" style="font-size:0.72rem;"></i>
                                        <?php else: ?>
                                            <i class="fas fa-mobile-alt" style="font-size:0.72rem;"></i>
                                        <?php endif; ?>
                                        <?php echo e(ucfirst($transaction->payment_method)); ?>

                                    </span>
                                </td>
                                <td>
                                    <span class="details-cell" title="<?php echo e($transaction->details); ?>">
                                        <?php echo e($transaction->details ?? '—'); ?>

                                    </span>
                                </td>
                                <td>
                                    <a href="<?php echo e(route('transactions.show', $transaction->id)); ?>"
                                       class="btn btn-sm btn-info"
                                       title="View transaction">
                                        <i class="fas fa-eye"></i>
                                    </a>
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                                <td colspan="6">
                                    <div class="empty-state">
                                        <i class="fas fa-inbox fa-3x"></i>
                                        <p>No transactions found.<br>
                                            <a href="<?php echo e(route('transactions.create')); ?>" class="btn btn-primary btn-sm" style="margin-top:8px;">
                                                + Add Transaction
                                            </a>
                                        </p>
                                    </div>
                                </td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>

            
            <div class="tx-card-list">
                <?php $__empty_1 = true; $__currentLoopData = $transactions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transaction): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <div class="tx-card <?php echo e($transaction->type == 'income' ? 'income-card' : 'expense-card'); ?>">
                        <div class="tx-card-top">
                            <div class="tx-card-left">
                                <div class="tx-card-date">
                                    <?php echo e($transaction->date->format('M d, Y')); ?>

                                </div>
                                <div class="tx-card-details" title="<?php echo e($transaction->details); ?>">
                                    <?php echo e($transaction->details ?? '—'); ?>

                                </div>
                            </div>
                            <div class="tx-card-amount <?php echo e($transaction->type); ?>">
                                <?php echo e($transaction->type == 'income' ? '+' : '−'); ?>৳<?php echo e(number_format($transaction->amount, 2)); ?>

                            </div>
                        </div>
                        <div class="tx-card-bottom">
                            <div class="tx-card-meta">
                                <span class="badge <?php echo e($transaction->type == 'income' ? 'badge-income' : 'badge-expense'); ?>">
                                    <?php echo e(ucfirst($transaction->type)); ?>

                                </span>
                                <span class="method-pill">
                                    <?php if($transaction->payment_method == 'cash'): ?>
                                        <i class="fas fa-money-bill-wave" style="font-size:0.68rem;"></i>
                                    <?php elseif($transaction->payment_method == 'bank'): ?>
                                        <i class="fas fa-university" style="font-size:0.68rem;"></i>
                                    <?php else: ?>
                                        <i class="fas fa-mobile-alt" style="font-size:0.68rem;"></i>
                                    <?php endif; ?>
                                    <?php echo e(ucfirst($transaction->payment_method)); ?>

                                </span>
                            </div>
                            <a href="<?php echo e(route('transactions.show', $transaction->id)); ?>"
                               class="btn btn-sm btn-info">
                                <i class="fas fa-eye"></i> View
                            </a>
                        </div>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <div class="empty-state">
                        <i class="fas fa-inbox fa-2x"></i>
                        <p>No transactions found.</p>
                        <a href="<?php echo e(route('transactions.create')); ?>" class="btn btn-primary btn-sm">
                            + Add Transaction
                        </a>
                    </div>
                <?php endif; ?>
            </div>

            
            <?php if($transactions->hasPages()): ?>
                <div class="pagination-wrapper">
                    <?php echo e($transactions->links()); ?>

                </div>
            <?php endif; ?>

        </div>
    </div>

</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\startup sabbir\Desktop\jannat\sarvice-accounts\accounting-system\resources\views/transactions/index.blade.php ENDPATH**/ ?>