/* Loading States - Affiluxe.com.tr */

/* Skeleton Loading Animation */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

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

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-title {
    height: 1.5rem;
    margin-bottom: 1rem;
}

.skeleton-image {
    height: 200px;
    width: 100%;
    border-radius: 8px;
}

.skeleton-card {
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}

/* Spinner Loading */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #5649C0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.spinner-large {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-content {
    text-align: center;
    color: #5649C0;
}

.loading-text {
    margin-top: 1rem;
    font-weight: 500;
}

/* Button Loading States */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn-loading .btn-text {
    opacity: 0;
}

/* Card Loading States */
.card-loading {
    position: relative;
    overflow: hidden;
}

.card-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Product Grid Loading */
.products-loading {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.product-skeleton {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    overflow: hidden;
}

.product-skeleton-image {
    height: 150px;
    width: 100%;
    margin-bottom: 1rem;
}

.product-skeleton-title {
    height: 1.2rem;
    margin-bottom: 0.5rem;
}

.product-skeleton-price {
    height: 1rem;
    width: 60%;
}

/* Search Loading */
.search-loading {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
}

.search-loading .spinner {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* Form Loading */
.form-loading {
    position: relative;
    pointer-events: none;
}

.form-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.form-loading .spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 11;
}

/* Responsive Loading States */
@media (max-width: 768px) {
    .products-loading {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.75rem;
    }
    
    .product-skeleton-image {
        height: 120px;
    }
    
    .skeleton-image {
        height: 150px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .skeleton,
    .spinner,
    .card-loading::before,
    .btn-loading::after {
        animation: none;
    }
    
    .skeleton {
        background: #f0f0f0;
    }
}