/* ? Gamification Homepage Widgets - Custom Styles */

/* ==========================================================================
   ANIMATIONS LIBRARY
   ========================================================================== */

/* Shimmer Effect - for newly unlocked badges */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer-effect {
    animation: shimmer 3s infinite;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 1000px 100%;
}

/* Pulse Animation - for CTA buttons and important elements */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(var(--bs-primary-rgb), 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(var(--bs-primary-rgb), 0);
    }
}

.pulse-animation {
    animation: pulse 2s ease-in-out infinite;
}

/* Float Animation - for decorative elements */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

/* Shake Animation - for notifications and alerts */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.shake-animation {
    animation: shake 0.5s;
}

/* Glow Pulse - for achievement highlights */
@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(var(--bs-warning-rgb), 0.5),
                    0 0 10px rgba(var(--bs-warning-rgb), 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(var(--bs-warning-rgb), 0.8),
                    0 0 30px rgba(var(--bs-warning-rgb), 0.6);
    }
}

.glow-pulse-animation {
    animation: glow-pulse 2s ease-in-out infinite;
}

/* Rotate Animation - for badges and icons */
@keyframes rotate-slow {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.rotate-slow-animation {
    animation: rotate-slow 20s linear infinite;
}

/* Bounce Animation - for interactive elements */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

.bounce-animation {
    animation: bounce 2s ease-in-out infinite;
}

/* Scale Up Animation - for hover effects */
@keyframes scale-up {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(1.1);
    }
}

.scale-up-animation {
    animation: scale-up 0.3s ease forwards;
}

/* Fade In Animation - for content loading */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-animation {
    animation: fade-in 0.6s ease-out;
}

/* Slide In From Right - for notifications */
@keyframes slide-in-right {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in-right-animation {
    animation: slide-in-right 0.5s ease-out;
}

/* Flip Animation - for card reveals */
@keyframes flip {
    from {
        transform: rotateY(0deg);
    }
    to {
        transform: rotateY(180deg);
    }
}

.flip-animation {
    animation: flip 0.6s ease-in-out;
}

/* Achievement Badges Gallery */
.badges-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.badge-showcase-card {
    background: #fff;
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.badge-showcase-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
}

/* Rarity-based styling */
.badge-showcase-card.rarity-legendary {
    border-color: #ff6b00;
}

.badge-showcase-card.rarity-legendary::before {
    background: linear-gradient(90deg, #ff6b00, #ffa500);
}

.badge-showcase-card.rarity-epic {
    border-color: #a335ee;
}

.badge-showcase-card.rarity-epic::before {
    background: linear-gradient(90deg, #a335ee, #c969ff);
}

.badge-showcase-card.rarity-rare {
    border-color: #0070dd;
}

.badge-showcase-card.rarity-rare::before {
    background: linear-gradient(90deg, #0070dd, #4d9eff);
}

.badge-showcase-card.rarity-uncommon {
    border-color: #1eff00;
}

.badge-showcase-card.rarity-uncommon::before {
    background: linear-gradient(90deg, #1eff00, #7fff59);
}

.badge-showcase-card.rarity-common::before {
    background: linear-gradient(90deg, #9d9d9d, #c5c5c5);
}

.badge-showcase-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Apply animations to specific badge rarities */
.badge-showcase-card.rarity-legendary {
    animation: glow-pulse 2s ease-in-out infinite;
}

.badge-showcase-card.rarity-legendary:hover {
    animation: glow-pulse 1s ease-in-out infinite, float 2s ease-in-out infinite;
}

.badge-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 150%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.badge-showcase-card:hover .badge-glow {
    opacity: 0.15;
}

.rarity-legendary .badge-glow {
    background: radial-gradient(circle, #ff6b00, transparent);
}

.rarity-epic .badge-glow {
    background: radial-gradient(circle, #a335ee, transparent);
}

.rarity-rare .badge-glow {
    background: radial-gradient(circle, #0070dd, transparent);
}

.rarity-uncommon .badge-glow {
    background: radial-gradient(circle, #1eff00, transparent);
}

.rarity-common .badge-glow {
    background: radial-gradient(circle, #9d9d9d, transparent);
}

.badge-icon-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bs-primary-rgb), 0.05);
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.badge-showcase-card:hover .badge-icon-wrapper {
    transform: scale(1.1) rotate(5deg);
}

.badge-icon-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.badge-icon-fallback {
    font-size: 2.5rem;
    color: var(--bs-warning);
}

.badge-name {
    font-size: 1rem;
    color: var(--bs-dark);
}

.badge-description {
    font-size: 0.85rem;
    line-height: 1.4;
    min-height: 2.8em;
}

.badge-rarity-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #fff;
}

.badge-rarity-tag.rarity-legendary {
    background: linear-gradient(135deg, #ff6b00, #ffa500);
}

.badge-rarity-tag.rarity-epic {
    background: linear-gradient(135deg, #a335ee, #c969ff);
}

.badge-rarity-tag.rarity-rare {
    background: linear-gradient(135deg, #0070dd, #4d9eff);
}

.badge-rarity-tag.rarity-uncommon {
    background: linear-gradient(135deg, #1eff00, #7fff59);
    color: #000;
}

.badge-rarity-tag.rarity-common {
    background: linear-gradient(135deg, #9d9d9d, #c5c5c5);
}

.badge-points {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--bs-warning);
}

/* Dark Theme Support */
[data-theme="dark"] .badge-showcase-card {
    background: rgba(30, 38, 46, 0.9);
}

[data-theme="dark"] .badge-name {
    color: #e2e8f0;
}

[data-theme="dark"] .badge-description {
    color: #94a3b8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .badges-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .badge-showcase-card {
        padding: 1rem;
    }

    .badge-icon-wrapper {
        width: 60px;
        height: 60px;
    }

    .badge-icon-img {
        width: 45px;
        height: 45px;
    }

    .badge-icon-fallback {
        font-size: 2rem;
    }
}

/* ==========================================================================
   UTILITY CLASSES FOR ANIMATIONS
   ========================================================================== */

/* Hover Effects */
.hover-float:hover {
    animation: float 1.5s ease-in-out infinite;
}

.hover-pulse:hover {
    animation: pulse 1s ease-in-out infinite;
}

.hover-glow:hover {
    animation: glow-pulse 1.5s ease-in-out infinite;
}

/* Entrance Animations */
.entrance-fade-in {
    animation: fade-in 0.6s ease-out;
}

.entrance-slide-right {
    animation: slide-in-right 0.5s ease-out;
}

/* Achievement Unlocked Effect */
@keyframes achievement-unlock {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.achievement-unlock-animation {
    animation: achievement-unlock 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Confetti Burst Effect - for major achievements */
@keyframes confetti {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-200px) rotate(720deg);
        opacity: 0;
    }
}

.confetti-animation {
    animation: confetti 1.5s ease-out;
}

/* Italian Rarity Labels Helper (add to @functions block in Index.cshtml):
@functions {
    private string GetRarityLabelItalian(string rarity)
    {
        return rarity?.ToLowerInvariant() switch
        {
            "legendary" => "Leggendario",
            "epic" => "Epico",
            "rare" => "Raro",
            "uncommon" => "Non Comune",
            "common" => "Comune",
            _ => rarity ?? "Comune"
        };
    }
}
*/
