/**
 * منصة يونيميديا - مكونات التحميل والحالات الفارغة
 * Skeleton Loading + Empty States + Animations
 * Phase 2: UX Enhancement
 */

/* ================================
   متغيرات الألوان
   ================================ */
:root {
    --skeleton-base: #2d2d2d;
    --skeleton-shine: #3d3d3d;
    --skeleton-animation-duration: 1.5s;

    --empty-state-bg: rgba(139, 92, 246, 0.05);
    --empty-state-border: rgba(139, 92, 246, 0.2);
    --empty-state-icon: #8b5cf6;

    --success-soft: rgba(16, 185, 129, 0.1);
    --warning-soft: rgba(245, 158, 11, 0.1);
    --primary-soft: rgba(139, 92, 246, 0.1);
}

/* ================================
   Skeleton Loading - الهيكل العظمي
   ================================ */
.skeleton {
    background: linear-gradient(90deg,
            var(--skeleton-base) 0%,
            var(--skeleton-shine) 50%,
            var(--skeleton-base) 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer var(--skeleton-animation-duration) infinite ease-in-out;
    border-radius: 8px;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* أنواع Skeleton */
.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text.short {
    width: 40%;
}

.skeleton-text.medium {
    width: 70%;
}

.skeleton-text.long {
    width: 100%;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
}

.skeleton-avatar.small {
    width: 40px;
    height: 40px;
}

.skeleton-avatar.large {
    width: 80px;
    height: 80px;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: 12px;
}

.skeleton-button {
    width: 120px;
    height: 40px;
    border-radius: 8px;
}

.skeleton-badge {
    width: 80px;
    height: 28px;
    border-radius: 20px;
}

/* بطاقة Skeleton كاملة */
.skeleton-card {
    background: rgba(30, 30, 30, 0.8);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.skeleton-card .skeleton-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.skeleton-card .skeleton-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-card .skeleton-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* شبكة Skeleton */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* ================================
   حالات الفارغة - Empty States
   ================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--empty-state-bg);
    border: 2px dashed var(--empty-state-border);
    border-radius: 20px;
    margin: 20px 0;
}

.empty-state-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 25px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float 3s ease-in-out infinite;
}

.empty-state-icon i {
    font-size: 48px;
    color: var(--empty-state-icon);
}

.empty-state-icon svg {
    width: 64px;
    height: 64px;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}

.empty-state-description {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto 25px;
}

.empty-state-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* أنواع الحالات الفارغة */
.empty-state.no-results {
    --empty-state-icon: #f59e0b;
    --empty-state-border: rgba(245, 158, 11, 0.3);
}

.empty-state.coming-soon {
    --empty-state-icon: #3b82f6;
    --empty-state-border: rgba(59, 130, 246, 0.3);
}

.empty-state.success {
    --empty-state-icon: #10b981;
    --empty-state-border: rgba(16, 185, 129, 0.3);
    --empty-state-bg: rgba(16, 185, 129, 0.05);
}

/* ================================
   تأثيرات الأزرار المحسنة
   ================================ */
.btn-premium {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 50%, #3b82f6 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-premium::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-premium:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

.btn-premium:hover::before {
    left: 100%;
}

.btn-glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 28px;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

/* ================================
   تحسينات البطاقات
   ================================ */
.card-premium {
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.card-premium::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #8b5cf6, #3b82f6, #10b981);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-premium:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(139, 92, 246, 0.3);
}

.card-premium:hover::before {
    opacity: 1;
}

/* ================================
   شارات الحالة
   ================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.available {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.busy {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.offline {
    background: rgba(107, 114, 128, 0.15);
    color: #9ca3af;
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.status-badge.featured {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.2));
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.4);
}

.status-badge i {
    font-size: 0.75rem;
}

/* ================================
   تحسينات التنقل والفلاتر
   ================================ */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-chip:hover,
.filter-chip.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.2));
    border-color: rgba(139, 92, 246, 0.5);
    color: white;
}

.filter-chip.active {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

/* ================================
   مؤشرات التحميل
   ================================ */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

.loading-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: #8b5cf6;
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* تحميل كامل الصفحة */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    gap: 20px;
}

.page-loader-logo {
    font-size: 3rem;
    color: #8b5cf6;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.page-loader-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
}

/* ================================
   تأثيرات الظهور
   ================================ */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
}

.fade-in-down {
    animation: fadeInDown 0.5s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* تأخير الظهور */
.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

.delay-4 {
    animation-delay: 0.4s;
}

.delay-5 {
    animation-delay: 0.5s;
}

/* ================================
   Tooltips محسنة
   ================================ */
.tooltip-premium {
    position: relative;
}

.tooltip-premium::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.tooltip-premium:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-10px);
}

/* ================================
   تحسينات الجدول
   ================================ */
.table-premium {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: rgba(30, 30, 30, 0.8);
    border-radius: 16px;
    overflow: hidden;
}

.table-premium thead {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.2));
}

.table-premium th {
    padding: 16px 20px;
    text-align: right;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.table-premium td {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
}

.table-premium tbody tr {
    transition: background 0.3s ease;
}

.table-premium tbody tr:hover {
    background: rgba(139, 92, 246, 0.1);
}

/* ================================
   RTL Support
   ================================ */
[dir="rtl"] .skeleton-card .skeleton-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .status-badge {
    flex-direction: row-reverse;
}

/* ================================
   Responsive
   ================================ */
@media (max-width: 768px) {
    .skeleton-grid {
        grid-template-columns: 1fr;
    }

    .empty-state {
        padding: 40px 15px;
    }

    .empty-state-icon {
        width: 100px;
        height: 100px;
    }

    .empty-state-icon i {
        font-size: 36px;
    }

    .empty-state-actions {
        flex-direction: column;
    }

    .btn-premium,
    .btn-glass {
        width: 100%;
        text-align: center;
    }
}