/* =========================================
   تنسيقات صفحة القوائم المتقدمة (list.css)
   ========================================= */

/* --- 1. قسم الإحصائيات العلوية --- */
.list-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
    margin-top: -30px; /* تداخل بسيط مع الهيرو */
    position: relative;
    z-index: 2;
}

.stat-box {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease;
    border: 1px solid rgba(0,0,0,0.03);
}

.stat-box:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue { background: rgba(0, 86, 179, 0.1); color: var(--primary-color); }
.stat-icon.green { background: rgba(40, 167, 69, 0.1); color: #28a745; }
.stat-icon.gold { background: rgba(197, 160, 89, 0.1); color: var(--secondary-color); }

.stat-info h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.stat-info p {
    margin: 5px 0 0;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* --- 2. شريط البحث والتحكم --- */
.controls-container {
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
}

.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
}

.search-wrapper input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 50px;
    font-size: 1rem;
    font-family: 'Cairo', sans-serif;
    background: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    transition: all 0.3s ease;
}

.search-wrapper input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 4px 20px rgba(197, 160, 89, 0.15);
}

.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1.1rem;
}

/* --- 3. بطاقة الجدول --- */
.table-card {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.05);
    overflow: hidden;
    border: 1px solid #f0f0f0;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px; /* لضمان عرض مريح على الموبايل */
}

/* الترويسة */
.data-table thead {
    background: var(--primary-color); /* لون الهوية */
    color: #fff;
}

.data-table th {
    padding: 20px;
    text-align: right;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* الصفوف */
.data-table td {
    padding: 18px 20px;
    border-bottom: 1px solid #f5f5f5;
    color: var(--text-dark);
    font-size: 0.95rem;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: #f9fbfd; /* لون خفيف عند التحويم */
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* --- 4. التنسيقات الداخلية للجدول --- */

/* رقم الاعتماد */
.data-table td strong {
    color: var(--primary-color);
    font-family: 'Arial', sans-serif; /* للأرقام الإنجليزية */
    letter-spacing: 0.5px;
}

/* حالات الاعتماد (Badges) - احترافي */
.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    min-width: 100px;
}

.status.active {
    background-color: #e6f4ea;
    color: #1e7e34;
    border: 1px solid rgba(30, 126, 52, 0.1);
}

.status.expired {
    background-color: #fde8e8;
    color: #c53030;
    border: 1px solid rgba(197, 48, 48, 0.1);
}

.status i { font-size: 0.8rem; }

/* أيقونة الشهادة */
.pdf-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background-color: #fff5f5;
    color: #e02424;
    border-radius: 50%;
    transition: all 0.3s ease;
    border: 1px solid #ffe3e3;
}

.pdf-icon:hover {
    background-color: #e02424;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(224, 36, 36, 0.3);
}

/* --- 5. حالات التحميل وعدم وجود نتائج --- */
.loading-row {
    text-align: center;
    padding: 40px !important;
    color: var(--text-light);
}

.spinner {
    display: inline-block;
    width: 25px;
    height: 25px;
    border: 3px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top-color: var(--secondary-color);
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

.no-results-state {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 12px;
    border: 1px dashed #ddd;
    margin-top: 30px;
}

.no-results-state i {
    font-size: 3rem;
    color: #ccc;
    margin-bottom: 15px;
}

.no-results-state h3 {
    margin: 0 0 10px;
    color: var(--text-dark);
}

.no-results-state p {
    margin: 0;
    color: var(--text-light);
}

/* --- 6. التجاوب (Mobile) --- */
@media (max-width: 768px) {
    .list-stats {
        margin-top: 0;
        grid-template-columns: 1fr;
    }
    
    .data-table th, .data-table td {
        padding: 15px;
    }
    
    /* جعل الجدول قابلاً للتمرير بسلاسة */
    .table-responsive::-webkit-scrollbar {
        height: 6px;
    }
    .table-responsive::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 3px;
    }
}