/* W33Keys - Itch Grid Cards Loading & Enhancements */

/* Loading Container */
.loading-container {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    min-height: 300px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(139, 92, 246, 0.2);
    border-top: 4px solid #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Button Shimmer Effect */
.itch-btn-primary {
    position: relative;
    overflow: hidden;
}

.itch-btn-primary::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;
}

.itch-btn-primary:hover::before {
    left: 100%;
}

/* Card Entrance Animations */
.itch-card {
    animation-fill-mode: both;
}

.itch-card:nth-child(1) {
    animation-delay: 0.1s;
}

.itch-card:nth-child(2) {
    animation-delay: 0.2s;
}

.itch-card:nth-child(3) {
    animation-delay: 0.3s;
}

.itch-card:nth-child(4) {
    animation-delay: 0.4s;
}

.itch-card:nth-child(5) {
    animation-delay: 0.5s;
}

.itch-card:nth-child(6) {
    animation-delay: 0.6s;
}

.itch-card:nth-child(n+7) {
    animation-delay: 0.7s;
}

.card-slide-in {
    animation: slideInUp 0.6s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Hover Effects */
.itch-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        transparent, 
        rgba(139, 92, 246, 0.1), 
        transparent
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.itch-card:hover::after {
    opacity: 1;
}

/* Badge Animations */
.itch-badge.featured {
    animation: badgePulse 2s ease-in-out infinite;
}

.itch-badge.sale {
    animation: saleFlash 1.5s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes saleFlash {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(236, 72, 153, 0.4);
    }
    50% {
        box-shadow: 0 4px 16px rgba(236, 72, 153, 0.8);
    }
}

/* Price Animation */
.itch-card-price {
    transition: all 0.3s ease;
}

.itch-card:hover .itch-card-price {
    transform: scale(1.05);
}

/* Image Overlay Effect */
.itch-card-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, 
        transparent 0%, 
        rgba(0, 0, 0, 0.3) 100%
    );
    z-index: 1;
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner {
        animation: none;
    }
    
    .loading-text {
        animation: none;
    }
    
    .itch-badge.featured,
    .itch-badge.sale {
        animation: none;
    }
    
    .card-slide-in {
        animation: none;
    }
    
    .itch-card {
        animation: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .itch-card {
        border-width: 2px;
        border-color: #ffffff;
    }
    
    .itch-badge {
        border: 1px solid #ffffff;
    }
    
    .itch-btn {
        border: 1px solid #ffffff;
    }
}

/* Focus Indicators */
.itch-card:focus-visible {
    outline: 3px solid #8b5cf6;
    outline-offset: 2px;
}

.itch-btn:focus-visible {
    outline: 3px solid #8b5cf6;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .itch-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .itch-card-header {
        height: auto;
        min-height: 100px;
    }
    
    .loading-spinner {
        display: none;
    }
}