/* Custom Animations and Styles */

/* Stars Background */
.stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(2px 2px at 20px 30px, #eee, rgba(0,0,0,0)), 
                      radial-gradient(2px 2px at 40px 70px, #fff, rgba(0,0,0,0)), 
                      radial-gradient(1px 1px at 90px 40px, #fff, rgba(0,0,0,0)), 
                      radial-gradient(2px 2px at 160px 120px, #ddd, rgba(0,0,0,0));
    background-repeat: repeat;
    background-size: 200px 200px;
    opacity: 0.3;
    animation: twinkle 4s infinite;
}

@keyframes twinkle {
    0% { opacity: 0.2; }
    50% { opacity: 0.5; }
    100% { opacity: 0.2; }
}

.sparkle-1, .sparkle-2, .sparkle-3 {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background-color: white;
    box-shadow: 0 0 4px 2px rgba(255, 223, 0, 0.5);
}

.sparkle-1 {
    top: 15%;
    left: 20%;
    animation: float-sparkle 7s infinite;
}

.sparkle-2 {
    top: 25%;
    right: 20%;
    animation: float-sparkle 5s infinite;
}

.sparkle-3 {
    bottom: 30%;
    left: 50%;
    animation: float-sparkle 8s infinite 1s;
}

@keyframes float-sparkle {
    0% { transform: translate(0, 0) scale(1); opacity: 0.8; }
    25% { transform: translate(10px, -15px) scale(1.5); opacity: 1; }
    50% { transform: translate(0, -25px) scale(1); opacity: 0.6; }
    75% { transform: translate(-10px, -15px) scale(1.2); opacity: 0.9; }
    100% { transform: translate(0, 0) scale(1); opacity: 0.8; }
}

/* Character Cards */
.character-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.character-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px -5px rgba(148, 68, 252, 0.3);
}

.character-card .card-shine {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    overflow: hidden;
    pointer-events: none;
}

.character-card .card-shine::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.02) 30%,
        rgba(255, 255, 255, 0.1) 45%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.1) 55%,
        rgba(255, 255, 255, 0.02) 70%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(45deg) translateY(-100%);
    opacity: 0;
    transition: all 0.5s ease;
}

.character-card:hover .card-shine::after {
    opacity: 1;
    transform: rotate(45deg) translateY(100%);
}

/* Filter Buttons */
.filter-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    background-color: rgba(155, 89, 182, 0.1);
    color: #a29bfe;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background-color: rgba(155, 89, 182, 0.2);
}

.filter-btn.active {
    background-color: #9b59b6;
    color: white;
}

/* Scroll Animation */
@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

/* Modal Animation */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#character-modal.active {
    display: block;
    animation: modalFadeIn 0.3s ease forwards;
}

/* Wand pointing animation for modal */
.wand-pointer {
    position: relative;
    display: inline-block;
}

.wand-pointer::after {
    content: "⚡";
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    color: #f39c12;
    animation: wandBounce 0.6s infinite alternate;
}

@keyframes wandBounce {
    from { transform: translateY(-50%); }
    to { transform: translateY(-50%) translateX(5px); }
}

/* Flying magical elements */
.floating-element {
    position: absolute;
    opacity: 0.2;
    pointer-events: none;
    z-index: -1;
}

.floating-element-1 {
    top: 10%;
    left: 5%;
    animation: float 8s ease-in-out infinite;
}

.floating-element-2 {
    top: 70%;
    right: 10%;
    animation: float 12s ease-in-out infinite 1s;
}

.floating-element-3 {
    bottom: 15%;
    left: 15%;
    animation: float 10s ease-in-out infinite 2s;
}

@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(15px, -15px) rotate(5deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}
