/* Solve Animation Plugin Styles */

/* ========== Overlay ========== */
.solve-animation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    animation: overlayFadeIn 0.3s ease-out forwards;
}

.solve-animation-overlay.fade-out {
    animation: overlayFadeOut 0.5s ease-out forwards;
}

/* ========== Lock Container ========== */
.solve-lock-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    position: relative;
}

/* ========== Close button (Final challenge) ========== */
.solve-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 100000;
    width: 3rem;
    height: 3rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
    color: #fff;
    background: rgba(0, 0, 0, 0.75);
    border: 2px solid rgba(255, 215, 0, 0.9);
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.solve-close-btn span {
    display: block;
    line-height: 1;
}

.solve-close-btn:hover {
    color: #000;
    background: rgba(255, 215, 0, 0.9);
    border-color: rgba(255, 215, 0, 1);
    box-shadow: 0 0 24px rgba(255, 215, 0, 0.6);
}

.solve-close-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.8);
}

/* ========== Custom Media Container (GIF/Video) ========== */
.solve-media-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.solve-final-container {
    position: relative;
}

.solve-custom-media {
    max-width: 90vw;
    max-height: 60vh;
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.4);
    animation: mediaFadeIn 0.3s ease-out forwards;
}

.solve-final-media {
    width: min(90vw, 960px);
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.4);
    animation: mediaFadeIn 0.3s ease-out forwards;
}

.solve-final-media iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.solve-final-video {
    max-width: min(90vw, 960px);
    max-height: 60vh;
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.4);
}

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

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

/* ========== Lock Icon ========== */
.solve-lock {
    position: relative;
    width: 120px;
    height: 120px;
}

.solve-lock-body {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 78px;
    background: linear-gradient(145deg, #ffd700, #ffaa00);
    border-radius: 14px;
    box-shadow:
        0 0 30px rgba(255, 215, 0, 0.5),
        0 0 60px rgba(255, 170, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
    animation: lockBodyGlow 1s ease-in-out infinite alternate;
}

.solve-lock-body::before {
    content: '';
    position: absolute;
    top: 48%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background: #333;
    border-radius: 50%;
    box-shadow: 0 10px 0 0 #333;
}

.solve-lock-body::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 12px;
    width: 30px;
    height: 18px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 12px;
    transform: rotate(-10deg);
}

.solve-lock-shackle {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 64px;
    border: 10px solid #c0c0c0;
    border-bottom: none;
    border-radius: 36px 36px 0 0;
    transform-origin: left bottom;
    animation: shackleOpen 0.6s ease-out 0.3s forwards;
    box-shadow:
        0 0 20px rgba(192, 192, 192, 0.5),
        inset 0 2px 4px rgba(255, 255, 255, 0.4);
}


/* ========== Sparkle Effects ========== */
.solve-sparkles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    pointer-events: none;
}

.solve-sparkle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffd700;
    border-radius: 50%;
    opacity: 0;
}

.solve-sparkle:nth-child(1) {
    top: 20%;
    left: 10%;
    animation: sparkle 0.8s ease-out 0.5s forwards;
}

.solve-sparkle:nth-child(2) {
    top: 10%;
    left: 50%;
    animation: sparkle 0.8s ease-out 0.6s forwards;
}

.solve-sparkle:nth-child(3) {
    top: 20%;
    right: 10%;
    animation: sparkle 0.8s ease-out 0.7s forwards;
}

.solve-sparkle:nth-child(4) {
    top: 40%;
    left: 5%;
    animation: sparkle 0.8s ease-out 0.55s forwards;
}

.solve-sparkle:nth-child(5) {
    top: 40%;
    right: 5%;
    animation: sparkle 0.8s ease-out 0.65s forwards;
}

.solve-sparkle:nth-child(6) {
    top: 60%;
    left: 15%;
    animation: sparkle 0.8s ease-out 0.75s forwards;
}

.solve-sparkle:nth-child(7) {
    top: 60%;
    right: 15%;
    animation: sparkle 0.8s ease-out 0.45s forwards;
}

.solve-sparkle:nth-child(8) {
    top: 80%;
    left: 30%;
    animation: sparkle 0.8s ease-out 0.8s forwards;
}

/* ========== Keyframe Animations ========== */

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes overlayFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes shackleOpen {
    0% {
        transform: translateX(-50%) translateY(0) rotate(0deg) scaleX(1);
    }

    50% {
        transform: translateX(-50%) translateY(-8px) rotate(-10deg) scaleX(1);
    }

    100% {
        transform: translateX(-50%) translateY(-8px) rotate(0deg) scaleX(-1);
    }
}

@keyframes lockBodyGlow {
    from {
        box-shadow:
            0 0 30px rgba(255, 215, 0, 0.5),
            0 0 60px rgba(255, 170, 0, 0.3),
            inset 0 2px 4px rgba(255, 255, 255, 0.3);
    }

    to {
        box-shadow:
            0 0 50px rgba(255, 215, 0, 0.8),
            0 0 100px rgba(255, 170, 0, 0.5),
            inset 0 2px 4px rgba(255, 255, 255, 0.3);
    }
}


@keyframes sparkle {
    0% {
        opacity: 0;
        transform: scale(0);
    }

    50% {
        opacity: 1;
        transform: scale(1.5);
    }

    100% {
        opacity: 0;
        transform: scale(0) translateY(-30px);
    }
}
