/**
 * أنماط التحميل والانتظار
 * Loading States Styles
 */

/* ========================================
   Loading Overlay
   ======================================== */

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-logo i {
    font-size: 32px;
    color: #8b5cf6;
    z-index: 1;
}

.loading-ring {
    position: absolute;
    inset: 0;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: #94a3b8;
    font-size: 14px;
}

/* ========================================
   Button Loading
   ======================================== */

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-left: 8px;
}

/* ========================================
   Skeleton Loaders
   ======================================== */

.skeleton-container {
    display: grid;
    gap: 16px;
}

.skeleton-card,
.skeleton-list-item,
.skeleton-table-row,
.skeleton-stat {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;
}

/* Card Skeleton */
.skeleton-card {
    padding: 0;
}

.skeleton-image {
    width: 100%;
    height: 160px;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-content {
    padding: 16px;
}

.skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
    margin-bottom: 10px;
}

.skeleton-title {
    width: 70%;
    height: 16px;
}

.skeleton-text {
    width: 100%;
}

.skeleton-text.short {
    width: 50%;
}

/* List Skeleton */
.skeleton-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    flex-shrink: 0;
}

.skeleton-list-content {
    flex: 1;
}

/* Table Skeleton */
.skeleton-table-row {
    display: flex;
    gap: 16px;
    padding: 16px;
}

.skeleton-cell {
    flex: 1;
    height: 16px;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

/* Stats Skeleton */
.skeleton-stat {
    padding: 20px;
    text-align: center;
}

.skeleton-circle {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    margin: 0 auto 12px;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-number {
    width: 60%;
    height: 24px;
    margin: 0 auto 8px;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ========================================
   Progress Bar
   ======================================== */

.progress-bar-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 100000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.progress-bar-top.active {
    opacity: 1;
}

.progress-value {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #06b6d4);
    transition: width 0.3s ease;
    border-radius: 0 3px 3px 0;
}

/* ========================================
   Lazy Images
   ======================================== */

.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

/* ========================================
   Content Placeholder
   ======================================== */

.content-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #64748b;
    text-align: center;
}

.content-placeholder i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.content-placeholder p {
    font-size: 16px;
}

/* ========================================
   Pull to Refresh
   ======================================== */

.pull-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    padding: 12px 24px;
    background: linear-gradient(135deg, #1e1b4b, #0f172a);
    border-radius: 0 0 20px 20px;
    z-index: 9999;
    transition: transform 0.3s ease;
}

.pull-indicator.visible {
    transform: translateX(-50%) translateY(0);
}

.pull-indicator i {
    animation: spin 1s linear infinite;
}
