/* 
==============================================
    Enhanced Tables Component Styles
    نظام إدارة الجامعة - تحسين الجداول
==============================================
*/

/* ===== متغيرات الجداول ===== */
:root {
    /* ألوان الجداول */
    --table-primary-color: #667eea;
    --table-secondary-color: #f093fb;
    --table-success-color: #43e97b;
    --table-danger-color: #fa709a;
    --table-warning-color: #ffecd2;
    --table-info-color: #4facfe;
    
    /* ألوان الخلفية */
    --table-bg: #ffffff;
    --table-header-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --table-stripe-bg: #f8f9fa;
    --table-hover-bg: rgba(102, 126, 234, 0.1);
    --table-border-color: #e9ecef;
    
    /* ظلال الجداول */
    --table-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    --table-row-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ===== حاوي الجدول المحسن ===== */
.table-container-enhanced {
    background: var(--table-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--table-shadow);
    border: 1px solid var(--table-border-color);
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.table-container-enhanced:hover {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* ===== رأس الجدول ===== */
.table-header-enhanced {
    background: var(--table-header-bg);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-title i {
    font-size: 1.1rem;
    opacity: 0.9;
}

.table-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== الجدول المحسن ===== */
.table-enhanced {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--table-bg);
}

/* ===== رأس الجدول ===== */
.table-enhanced thead {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.table-enhanced thead th {
    padding: 1rem 1.5rem;
    font-weight: 700;
    color: var(--table-primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
    border-bottom: 3px solid var(--table-primary-color);
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.table-enhanced thead th:hover {
    background: rgba(102, 126, 234, 0.15);
    color: #4c63d2;
}

.table-enhanced thead th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    transition: all 0.3s ease;
}

.table-enhanced thead th.sortable:hover::after {
    opacity: 1;
    transform: translateY(-50%) scale(1.2);
}

.table-enhanced thead th.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: var(--table-success-color);
}

.table-enhanced thead th.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: var(--table-danger-color);
}

/* ===== صفوف الجدول ===== */
.table-enhanced tbody tr {
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--table-border-color);
}

.table-enhanced tbody tr:nth-child(even) {
    background: var(--table-stripe-bg);
}

.table-enhanced tbody tr:hover {
    background: var(--table-hover-bg);
    transform: scale(1.01);
    box-shadow: var(--table-row-shadow);
    z-index: 1;
    position: relative;
}

.table-enhanced tbody td {
    padding: 1rem 1.5rem;
    color: #2c3e50;
    font-size: 0.95rem;
    vertical-align: middle;
    transition: all 0.3s ease;
}

/* ===== خلايا خاصة ===== */
.table-enhanced .cell-number {
    font-weight: 700;
    color: var(--table-primary-color);
}

.table-enhanced .cell-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-enhanced .cell-status.status-active {
    background: rgba(67, 233, 123, 0.2);
    color: var(--table-success-color);
}

.table-enhanced .cell-status.status-inactive {
    background: rgba(250, 112, 154, 0.2);
    color: var(--table-danger-color);
}

.table-enhanced .cell-status.status-pending {
    background: rgba(255, 236, 210, 0.5);
    color: #d68910;
}

.table-enhanced .cell-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--table-border-color);
    transition: all 0.3s ease;
}

.table-enhanced .cell-avatar:hover {
    transform: scale(1.1);
    border-color: var(--table-primary-color);
}

/* ===== أزرار الإجراءات ===== */
.table-actions-cell {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    text-decoration: none;
}

.action-btn.btn-view {
    background: rgba(79, 172, 254, 0.2);
    color: var(--table-info-color);
}

.action-btn.btn-edit {
    background: rgba(67, 233, 123, 0.2);
    color: var(--table-success-color);
}

.action-btn.btn-delete {
    background: rgba(250, 112, 154, 0.2);
    color: var(--table-danger-color);
}

.action-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-btn.btn-view:hover {
    background: var(--table-info-color);
    color: white;
}

.action-btn.btn-edit:hover {
    background: var(--table-success-color);
    color: white;
}

.action-btn.btn-delete:hover {
    background: var(--table-danger-color);
    color: white;
}

/* ===== تصفية وبحث ===== */
.table-filters {
    padding: 1.5rem 2rem;
    background: rgba(102, 126, 234, 0.05);
    border-bottom: 1px solid var(--table-border-color);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.table-search {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.table-search input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 2px solid var(--table-border-color);
    border-radius: 10px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.table-search input:focus {
    outline: none;
    border-color: var(--table-primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.table-search i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
}

/* ===== تذييل الجدول ===== */
.table-footer {
    padding: 1rem 2rem;
    background: rgba(102, 126, 234, 0.05);
    display: flex;
    justify-content: between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    border-top: 1px solid var(--table-border-color);
}

.table-info {
    color: #6c757d;
    font-size: 0.9rem;
}

.table-pagination {
    display: flex;
    gap: 5px;
}

.page-btn {
    width: 35px;
    height: 35px;
    border: 1px solid var(--table-border-color);
    background: white;
    color: #6c757d;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 0.9rem;
}

.page-btn:hover,
.page-btn.active {
    background: var(--table-primary-color);
    color: white;
    border-color: var(--table-primary-color);
    transform: scale(1.05);
}

/* ===== جدول فارغ ===== */
.table-empty {
    text-align: center;
    padding: 3rem 2rem;
    color: #6c757d;
}

.table-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.table-empty h4 {
    margin-bottom: 0.5rem;
    color: #495057;
}

/* ===== الاستجابة للأجهزة المحمولة ===== */
@media (max-width: 768px) {
    .table-container-enhanced {
        border-radius: 15px;
        margin-bottom: 1.5rem;
    }
    
    .table-header-enhanced {
        padding: 1rem 1.5rem;
        flex-direction: column;
        text-align: center;
    }
    
    .table-enhanced {
        font-size: 0.85rem;
    }
    
    .table-enhanced thead th,
    .table-enhanced tbody td {
        padding: 0.75rem 1rem;
    }
    
    .table-filters {
        padding: 1rem 1.5rem;
        flex-direction: column;
    }
    
    .table-search {
        min-width: 100%;
    }
    
    .table-footer {
        padding: 1rem 1.5rem;
        flex-direction: column;
        text-align: center;
    }
}

/* ===== تأثيرات الحركة ===== */
.table-row-animate {
    animation: tableRowSlideIn 0.6s ease-out;
}

@keyframes tableRowSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.table-loading {
    position: relative;
}

.table-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.table-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--table-primary-color);
    border-radius: 50%;
    animation: tableSpinner 1s linear infinite;
    z-index: 11;
    transform: translate(-50%, -50%);
}

@keyframes tableSpinner {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (max-width: 576px) {
    .table-enhanced thead {
        display: none;
    }
    
    .table-enhanced tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--table-border-color);
        border-radius: 10px;
        padding: 1rem;
        background: white;
    }
    
    .table-enhanced tbody td {
        display: block;
        padding: 0.5rem 0;
        border: none;
        text-align: right;
    }
    
    .table-enhanced tbody td::before {
        content: attr(data-label) ": ";
        font-weight: 700;
        color: var(--table-primary-color);
        float: left;
    }
}
