/**
 * LEVEL UNLOCK ANIMATION
 * Epic animation when user levels up with glowing lock
 */

/* Overlay Container */
.level-unlock-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease-out;
}

.level-unlock-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main Card */
.level-unlock-card {
    background: linear-gradient(145deg, rgba(30, 30, 35, 0.95), rgba(20, 20, 25, 0.98));
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 24px;
    padding: 48px 56px;
    text-align: center;
    max-width: 420px;
    transform: scale(0.8) translateY(30px);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.level-unlock-overlay.active .level-unlock-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Glowing border effect */
.level-unlock-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg,
            #FFD700, #FFA500, #FFD700, #FF8C00,
            #FFD700, #FFA500, #FFD700, #FF8C00);
    background-size: 400% 400%;
    border-radius: 26px;
    z-index: -1;
    animation: borderGlow 3s ease-in-out infinite;
    opacity: 0.7;
}

@keyframes borderGlow {

    0%,
    100% {
        background-position: 0% 50%;
        opacity: 0.5;
    }

    50% {
        background-position: 100% 50%;
        opacity: 1;
    }
}

/* Lock Icon Container */
.unlock-icon-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Glowing Ring around lock - oscillating */
.unlock-glow-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
    background: linear-gradient(145deg, transparent, transparent) padding-box,
        linear-gradient(45deg, #FFD700, #FFA500, #FF8C00, #FFD700) border-box;
    animation: glowPulse 2s ease-in-out infinite, ringRotate 4s linear infinite;
}

@keyframes glowPulse {

    0%,
    100% {
        box-shadow:
            0 0 20px rgba(255, 215, 0, 0.4),
            0 0 40px rgba(255, 165, 0, 0.2),
            inset 0 0 20px rgba(255, 215, 0, 0.1);
        transform: scale(1);
    }

    50% {
        box-shadow:
            0 0 35px rgba(255, 215, 0, 0.7),
            0 0 60px rgba(255, 165, 0, 0.4),
            0 0 80px rgba(255, 140, 0, 0.2),
            inset 0 0 30px rgba(255, 215, 0, 0.2);
        transform: scale(1.05);
    }
}

@keyframes ringRotate {
    from {
        transform: rotate(0deg) scale(1);
    }

    to {
        transform: rotate(360deg) scale(1);
    }
}

/* Lock Icon */
.unlock-icon {
    width: 48px;
    height: 48px;
    color: #FFD700;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.6));
    animation: lockUnlock 1s ease-out 0.5s forwards;
}

@keyframes lockUnlock {

    0%,
    30% {
        transform: rotate(0deg) scale(1);
    }

    40% {
        transform: rotate(-10deg) scale(1.1);
    }

    50% {
        transform: rotate(10deg) scale(1.15);
    }

    60% {
        transform: rotate(-5deg) scale(1.1);
    }

    70%,
    100% {
        transform: rotate(0deg) scale(1);
    }
}

/* Level Number Badge */
.unlock-level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 800;
    padding: 8px 20px;
    border-radius: 50px;
    margin-bottom: 16px;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    animation: badgePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

@keyframes badgePop {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Level Name */
.unlock-level-name {
    font-size: 36px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
    animation: textFadeIn 0.5s ease-out 0.4s both;
}

@keyframes textFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Divider */
.unlock-divider {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #FFD700, transparent);
    margin: 16px auto;
    animation: textFadeIn 0.5s ease-out 0.5s both;
}

/* Reward Section */
.unlock-reward {
    animation: textFadeIn 0.5s ease-out 0.6s both;
}

.unlock-reward-title {
    font-size: 18px;
    font-weight: 600;
    color: #FFD700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.unlock-reward-desc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

/* Continue Button */
.unlock-continue-btn {
    margin-top: 32px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #1a1a1a;
    border: none;
    padding: 14px 40px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: textFadeIn 0.5s ease-out 0.7s both;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
}

.unlock-continue-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(255, 215, 0, 0.5);
}

.unlock-continue-btn:active {
    transform: translateY(0);
}

/* Floating Particles */
.unlock-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: hidden;
}

.unlock-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #FFD700;
    border-radius: 50%;
    animation: particleFloat 3s ease-in-out infinite;
    opacity: 0.6;
}

.unlock-particle:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
}

.unlock-particle:nth-child(2) {
    left: 20%;
    animation-delay: 0.5s;
}

.unlock-particle:nth-child(3) {
    left: 30%;
    animation-delay: 1s;
}

.unlock-particle:nth-child(4) {
    left: 40%;
    animation-delay: 1.5s;
}

.unlock-particle:nth-child(5) {
    left: 50%;
    animation-delay: 0.3s;
}

.unlock-particle:nth-child(6) {
    left: 60%;
    animation-delay: 0.8s;
}

.unlock-particle:nth-child(7) {
    left: 70%;
    animation-delay: 1.3s;
}

.unlock-particle:nth-child(8) {
    left: 80%;
    animation-delay: 0.2s;
}

.unlock-particle:nth-child(9) {
    left: 90%;
    animation-delay: 0.7s;
}

@keyframes particleFloat {

    0%,
    100% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }

    10% {
        opacity: 0.8;
    }

    50% {
        opacity: 0.4;
    }

    90% {
        opacity: 0;
    }

    95% {
        transform: translateY(-20px) scale(1);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .level-unlock-card {
        padding: 32px 24px;
        margin: 16px;
    }

    .unlock-level-name {
        font-size: 28px;
    }

    .unlock-icon-container {
        width: 80px;
        height: 80px;
    }

    .unlock-icon {
        width: 36px;
        height: 36px;
    }
}