/* ==================== LOADING STATES - الوسام طلبات ==================== */

/* ==================== SKELETON LOADING ==================== */

.skeleton {
    background: linear-gradient(90deg,
            var(--bg-secondary) 0%,
            var(--border-color) 50%,
            var(--bg-secondary) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md, 8px);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Skeleton Variants */
.skeleton-text {
    width: 100%;
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.long {
    width: 90%;
}

.skeleton-title {
    width: 70%;
    height: 1.5rem;
    margin-bottom: 1rem;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 16/9;
}

.skeleton-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-button {
    width: 120px;
    height: 44px;
    border-radius: 10px;
}

/* ==================== PRODUCT CARD SKELETON ==================== */

.product-skeleton {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 20px;
}

.product-skeleton .skeleton-image {
    aspect-ratio: 4/3;
}

/* ==================== SHIMMER EFFECT ==================== */

.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.2) 50%,
            transparent 100%);
    animation: shimmer-slide 2s ease-in-out infinite;
}

body.theme-dark .shimmer::before {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.1) 50%,
            transparent 100%);
}

@keyframes shimmer-slide {
    to {
        left: 100%;
    }
}

/* ==================== SPINNER ==================== */

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--brand-yellow);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 3px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 5px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Spinner Center */
.spinner-center {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* ==================== DOTS LOADER ==================== */

.dots-loader {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
}

.dots-loader .dot {
    width: 12px;
    height: 12px;
    background: var(--brand-yellow);
    border-radius: 50%;
    animation: dot-bounce 1.4s ease-in-out infinite;
}

.dots-loader .dot:nth-child(1) {
    animation-delay: 0s;
}

.dots-loader .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dots-loader .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dot-bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==================== PULSE LOADER ==================== */

.pulse-loader {
    width: 60px;
    height: 60px;
    position: relative;
}

.pulse-loader::before,
.pulse-loader::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--brand-yellow);
    animation: pulse 2s ease-in-out infinite;
}

.pulse-loader::after {
    animation-delay: 1s;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(0);
        opacity: 1;
    }

    50% {
        transform: scale(1);
        opacity: 0;
    }
}

/* ==================== PROGRESS BAR ==================== */

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: var(--radius-full, 9999px);
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-yellow) 0%, #FFB300 100%);
    border-radius: var(--radius-full, 9999px);
    transition: width 0.3s ease;
}

/* Indeterminate Progress */
.progress-bar-indeterminate .progress-bar-fill {
    width: 30%;
    animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(400%);
    }
}

/* ==================== LOADING OVERLAY ==================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay .spinner {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: var(--brand-yellow);
}

/* ==================== LAZY LOAD PLACEHOLDER ==================== */

.lazy-load-placeholder {
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}

.lazy-load-placeholder::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Font Awesome 6 Free';
    content: '\f03e';
    font-size: 3rem;
    color: var(--border-color);
    opacity: 0.3;
}

/* Image Loaded State */
img.loaded {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ==================== CONTENT LOADER ==================== */

.content-loader {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem;
}

.content-loader-item {
    display: flex;
    gap: 1rem;
}

.content-loader-item .skeleton-circle {
    flex-shrink: 0;
}

.content-loader-item .skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}