/* =============================================
   1rob tech - Show All Codes Animation Enhancements
   ============================================= */

/* Staggered Animation for Code Cards */
.codes-grid .code-card {
    animation-fill-mode: both;
}

/* Smooth reveal animation */
@keyframes revealCode {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.85);
        filter: blur(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* Smooth hide animation */
@keyframes hideCode {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
        filter: blur(5px);
    }
}

/* Enhanced button pulse animation */
@keyframes buttonPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    }
    50% {
        box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5),
                    0 0 30px rgba(79, 70, 229, 0.2);
    }
}

#toggleExpired:not(.active) {
    animation: buttonPulse 2s ease-in-out infinite;
}

/* Glow effect when codes are visible */
#toggleExpired.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

#toggleExpired.active:hover {
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.5),
                0 0 30px rgba(16, 185, 129, 0.3);
}

/* Loading state */
#toggleExpired.loading {
    pointer-events: none;
    opacity: 0.7;
}

#toggleExpired.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
}

@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Enhanced expired codes grid */
#expiredCodesGrid {
    position: relative;
}

#expiredCodesGrid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%,
        var(--primary) 50%,
        transparent 100%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

#expiredCodesGrid:not(.hidden)::before {
    opacity: 1;
    animation: slideInLine 0.8s ease-out;
}

@keyframes slideInLine {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Success message when codes are shown */
.codes-revealed-message {
    position: fixed;
    top: 100px;
    right: 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
    z-index: 9999;
    animation: slideInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1),
               fadeOut 0.5s ease-out 2.5s forwards;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.codes-revealed-message i {
    font-size: 1.25rem;
    animation: checkPulse 0.6s ease-out;
}

@keyframes checkPulse {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    #toggleExpired {
        padding: 0.875rem 2rem;
        font-size: 1rem;
    }
    
    .codes-revealed-message {
        right: 10px;
        left: 10px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    #toggleExpired {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
}
