/* --- General Styles --- */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --card-bg: #ffffff;
    --table-header-bg: #f0f2f5; /* رنگ ملايم براي هدر جدول */
}

body {
    font-family: 'Yekan', yekan, sans-serif;
    background-color: var(--light-color); /* پس‌زمينه کلي کمي روشن‌تر */
    color: var(--dark-color);
}

.container {
    max-width: 1200px; /* محدود کردن عرض کانتينر اصلي */
    margin-top: 30px;
    margin-bottom: 30px;
}

/* --- Card --- */
.main-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* --- Page Header --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px; /* padding بيشتر براي هدر صفحه */
    border-bottom: 1px solid var(--border-color);
    background-color: var(--card-bg); /* هدر هم همرنگ کارت */
}
.page-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    color: var(--dark-color);
}
.page-header h2 i {
    font-size: 1.6rem;
    color: var(--primary-color);
    margin-left: 12px;
}
.btn-add-new {
    font-size: 1rem;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}

/* --- Filter Section --- */
.filter-section {
    padding: 25px; /* padding بيشتر براي بخش فيلتر */
    background-color: var(--card-bg); /* همرنگ کارت */
    border-bottom: 1px solid var(--border-color);
}
.filter-section .form-label {
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
}
.filter-section .form-select,
.filter-section .form-control {
    height: 45px;
    border-radius: 8px; /* گوشه‌هاي گردتر */
    border: 1px solid var(--border-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.filter-section .form-select:focus,
.filter-section .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(0, 123, 255, 0.15);
}
.filter-section .btn-primary {
    height: 45px;
    font-weight: 600;
    border-radius: 8px;
}
.filter-section .btn-outline-secondary {
    height: 45px;
    font-weight: 600;
    border-radius: 8px;
}

/* --- Transactions Table --- */
.transactions-table {
    width: 100%;
    vertical-align: middle;
    border-collapse: separate; /* استفاده از separate براي اعمال border-radius */
    border-spacing: 0 10px; /* فاصله بين رديف‌ها */
    table-layout: auto; /* اجازه تنظيم خودکار عرض ستون‌ها */
}

.transactions-table thead th {
    background-color: var(--table-header-bg);
    color: var(--dark-color);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 15px 10px;
    text-align: center;
    border: none;
    position: sticky; /* براي هدر جدول در صورت اسکرول */
    top: 0;
    z-index: 10;
}
/* استايل براي اولين و آخرين ستون در هدر */
.transactions-table thead th:first-child,
.transactions-table thead th:last-child {
    background-color: var(--primary-color); /* رنگ متمايز براي ستون اول و آخر */
    color: white;
}

.transactions-table tbody td {
    font-size: 0.9rem;
    padding: 15px 10px; /* padding براي خانه‌ها */
    vertical-align: middle;
    text-align: center;
    background-color: var(--card-bg); /* پس‌زمينه خانه‌ها */
    border-bottom: 1px solid rgba(222, 226, 230, 0.5); /* بوردر ملايم پايين */
    border-top: 1px solid rgba(222, 226, 230, 0.5); /* بوردر ملايم بالا */
    transition: background-color 0.2s;
}
/* استايل براي رديف اول و آخر */
.transactions-table tbody tr:first-child td {
    border-top: none;
}
.transactions-table tbody tr:last-child td {
    border-bottom: none;
}

.transactions-table tbody tr:hover {
    background-color: var(--light-color); /* تغيير رنگ در هاور */
    cursor: pointer;
}
.transactions-table tbody tr:hover td {
    background-color: var(--light-color);
}

.transactions-table .amount-cell {
    font-weight: 600; /* وزن بيشتر براي مبلغ */
    color: var(--primary-color);
}

.transactions-table .action-cell .btn,
.transactions-table .btn-copy-authority {
    font-size: 0.85rem;
    padding: 5px 10px;
    border-radius: 6px;
    transition: all 0.2s;
}
.transactions-table .btn-copy-authority {
    background: transparent;
    border: none;
    color: var(--secondary-color);
    opacity: 0.7; /* کمي شفافيت */
}
.transactions-table tbody tr:hover .btn-copy-authority {
    opacity: 1; /* نمايش کامل در هاور */
}
.transactions-table .btn-copy-authority:hover {
    color: var(--primary-color);
    background: rgba(0, 123, 255, 0.1);
}
.transactions-table .action-cell .btn-details i,
.transactions-table .action-cell .btn-warning i {
    font-size: 1rem;
}

/* --- Status Badges --- */
.status-badge {
    padding: 7px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-block;
    text-align: center;
    min-width: 90px; /* عرض حداقل براي خوانايي بهتر */
    border: 1px solid transparent; /* اضافه کردن بوردر براي سازگاري */
}
.status-badge.pending { background-color: rgba(255, 193, 7, 0.15); color: var(--warning-color); border-color: rgba(255, 193, 7, 0.3); }
.status-badge.success { background-color: rgba(25, 135, 84, 0.15); color: var(--success-color); border-color: rgba(25, 135, 84, 0.3); }
.status-badge.failed { background-color: rgba(220, 53, 69, 0.15); color: var(--danger-color); border-color: rgba(220, 53, 69, 0.3); }


/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px; /* padding بيشتر */
    background-color: var(--card-bg); /* همرنگ کارت */
}
.empty-state .display-4 {
    font-size: 3.5rem;
    color: var(--primary-color);
    opacity: 0.7;
}
.empty-state h4 {
    margin-top: 20px;
    font-weight: 700;
    font-size: 1.5rem;
}
.empty-state p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* --- Pagination --- */
.pagination-container {
    padding: 20px 0 !important;
    background-color: var(--card-bg); /* همرنگ کارت */
}
.pagination .page-link {
    color: var(--primary-color);
    border-color: var(--border-color);
    font-weight: 500;
    margin: 0 3px; /* فاصله بين آيتم‌ها */
    border-radius: 6px;
    transition: all 0.2s;
}
.pagination .page-link:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 123, 255, 0.25);
}
.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}
.pagination .page-item:not(.active) .page-link:hover {
    background-color: var(--light-color);
    border-color: var(--primary-color);
}
.pagination .page-item.disabled .page-link {
    color: var(--text-muted);
    background-color: transparent;
    border-color: var(--border-color);
}

/* --- Modal --- */
.modal-content {
    border-radius: 10px;
    border: none;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}
.modal-header {
    background-color: var(--primary-color);
    color: white;
    border-bottom: none;
    padding: 18px 25px;
    border-radius: 10px 10px 0 0;
}
.modal-header .modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
}
.modal-header .btn-close {
    background-color: rgba(255, 255, 255, 0.2);
    opacity: 1;
}
.modal-header .btn-close:hover {
    background-color: rgba(255, 255, 255, 0.3);
}
.modal-body {
    padding: 30px 25px;
}
.detail-item {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}
.detail-item:last-child {
    margin-bottom: 0;
}
.detail-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 5px;
    font-weight: 500;
}
.detail-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--dark-color);
    word-break: break-all;
}
.detail-value code {
    background-color: var(--light-color);
    padding: 5px 9px;
    border-radius: 5px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}
.modal-footer {
    padding: 15px 25px;
    border-top: none;
    background-color: var(--light-color);
    border-radius: 0 0 10px 10px;
    justify-content: flex-start;
}
.modal-footer .btn-secondary {
    margin-left: auto;
}

/* --- Responsive Adjustments for Table (Mobile View) --- */
@media (max-width: 768px) {
    .transactions-table thead {
        display: none; /* مخفي کردن هدر در موبايل */
    }
    .transactions-table tbody td {
        display: flex; /* استفاده از فلکس براي چيدمان */
        justify-content: space-between; /* فاصله بين ليبل و مقدار */
        align-items: center;
        padding: 12px 15px;
        border-bottom: 1px solid var(--border-color);
        border-top: none; /* حذف بوردر بالا در حالت موبايل */
        text-align: right; /* راست چين کردن متن */
    }
    .transactions-table tbody td:first-child {
        border-top: 1px solid var(--border-color); /* اضافه کردن بوردر بالا براي اولين رديف */
        border-radius: 8px 8px 0 0; /* گرد کردن گوشه‌هاي بالا */
    }
     .transactions-table tbody tr:last-child td:first-child {
        border-radius: 8px; /* گرد کردن گوشه‌ها اگر فقط يک سطر باشد */
    }
    .transactions-table tbody tr:last-child td {
        border-radius: 0 0 8px 8px; /* گرد کردن گوشه‌هاي پايين */
    }
    .transactions-table tbody td::before {
        content: attr(data-label); /* نمايش ليبل ستون */
        font-weight: 600;
        color: var(--dark-color);
        margin-left: 10px;
        font-size: 0.9rem;
        flex-shrink: 0; /* جلوگيري از کوچک شدن ليبل */
    }
    .transactions-table td .btn-copy-authority,
    .transactions-table td .btn-details,
    .transactions-table td .btn-warning {
        opacity: 1; /* دکمه‌ها هميشه نمايش داده شوند */
        margin: 0 3px;
    }
    .transactions-table td .d-flex.justify-content-center.gap-1 {
        justify-content: flex-start !important; /* تنظيم جا براي دکمه‌هاي عمليات */
    }
    .transactions-table td .amount-cell {
         font-size: 1rem; /* افزايش سايز مبلغ در موبايل */
    }
    .transactions-table td .mobile i, .transactions-table td .email i {
        margin-left: 5px; /* تنظيم فاصله آيکون‌ها */
    }
    .page-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    .page-header h2 {
        font-size: 1.5rem;
    }
    .btn-add-new {
        width: 100%;
        font-size: 0.95rem;
        padding: 10px 15px;
    }
    .filter-section {
        padding: 15px;
    }
    .filter-section form .col-md-3,
    .filter-section form .col-md-5,
    .filter-section form .col-md-2 {
        flex: 1 1 100% !important; /* همه فيلترها عريض شوند */
        max-width: 100% !important;
        margin-bottom: 15px;
    }
     .filter-section form .col-md-2:last-child {
        margin-bottom: 0;
     }
    .pagination-container .pagination {
        flex-wrap: wrap; /* اجازه شکستن سطر پيجينيشن */
        justify-content: center !important;
    }
    .pagination-container .page-item {
        margin: 2px 1px;
    }
}
