/* ============================================
   Loading States for Artbella
   ============================================ */

/* ============================================
   1. Loading Overlay - شاشة التحميل الرئيسية
   ============================================ */

.page-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.page-loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Loading Spinner */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #F11B70;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   2. Skeleton Screens - هياكل التحميل
   ============================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Skeleton للكروت */
.skeleton-card {
    padding: 16px;
    margin-bottom: 16px;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    margin-bottom: 12px;
}

.skeleton-title {
    width: 80%;
    height: 20px;
    margin-bottom: 8px;
}

.skeleton-text {
    width: 60%;
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-price {
    width: 40%;
    height: 24px;
    margin-bottom: 12px;
}

.skeleton-button {
    width: 100%;
    height: 48px;
}

/* ============================================
   3. Button Loading States - حالات تحميل الأزرار
   ============================================ */

.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ============================================
   4. Progress Bar - شريط التقدم
   ============================================ */

.progress-bar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 9998;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #F11B70, #FF6B9D);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(241, 27, 112, 0.5);
}

/* ============================================
   5. Lazy Loading Images - تحميل الصور الكسول
   ============================================ */

img[data-src] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.loaded {
    opacity: 1;
}

img.loading {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

/* ============================================
   6. Pulse Animation - نبضات التحميل
   ============================================ */

.pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   7. Shimmer Effect - تأثير اللمعان
   ============================================ */

.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.3) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

/* ============================================
   8. Loading Text - نص التحميل
   ============================================ */

.loading-text {
    text-align: center;
    margin-top: 16px;
    color: #666;
    font-size: 14px;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* ============================================
   9. Spinner Variations - أشكال مختلفة
   ============================================ */

/* Small Spinner */
.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

/* Large Spinner */
.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 5px;
}

/* Colored Spinners */
.spinner-primary {
    border-top-color: #F11B70;
}

.spinner-success {
    border-top-color: #28a745;
}

.spinner-danger {
    border-top-color: #dc3545;
}

/* ============================================
   10. Content Placeholders - محتوى مؤقت
   ============================================ */

.content-placeholder {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.placeholder-icon {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 16px;
}

.placeholder-text {
    color: #999;
    font-size: 16px;
}

/* ============================================
   11. Mobile Optimizations
   ============================================ */

@media (max-width: 768px) {
    .loading-spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }
    
    .skeleton-image {
        height: 150px;
    }
    
    .loading-text {
        font-size: 13px;
    }
}
