/**
 * Gacha Reveal Styles
 * Confirmation modal, video container, card reveal with flip animation
 */

/* ==========================================
   CONFIRMATION MODAL
   ========================================== */
.gacha-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.gacha-confirm-modal.active {
    display: flex;
}

/* Video state: hide text content, show video in same modal style */
.gacha-confirm-modal.video-playing .gacha-confirm-content {
    padding: 0;
    max-width: 90vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    overflow: hidden;
}

.gacha-confirm-modal.video-playing .gacha-confirm-text-content {
    display: none;
}

.gacha-confirm-modal.video-playing .gacha-modal-video-wrapper {
    display: flex;
}

.gacha-modal-video-wrapper {
    display: none;
    position: relative;
    width: 100%;
    height: auto;
    align-items: center;
    justify-content: center;
    background: #000;
    border-radius: 18px;
    overflow: hidden;
}

.gacha-modal-video-wrapper video {
    width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.gacha-confirm-content {
    background: linear-gradient(135deg, #1a0d1f 0%, #2d1b3d 100%);
    border: 2px solid rgba(156, 39, 176, 0.5);
    border-radius: 20px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(156, 39, 176, 0.3);
    animation: gachaModalSlide 0.3s ease-out;
}

@keyframes gachaModalSlide {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

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

.gacha-confirm-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.gacha-confirm-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
}

.gacha-confirm-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.gacha-confirm-cost {
    color: #ff9800;
    font-weight: 700;
    font-size: 1.3rem;
}

.gacha-confirm-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.gacha-confirm-btn {
    padding: 0.8rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.gacha-confirm-btn.cancel {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.gacha-confirm-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.gacha-confirm-btn.confirm {
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.4);
}

.gacha-confirm-btn.confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.5);
}

/* ==========================================
   VIDEO CONTAINER (Legacy - kept for backward compatibility)
   ========================================== */
.gacha-video-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.gacha-video-container.active {
    display: flex;
}

.gacha-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gacha-skip-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(0, 0, 0, 0.5);
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
}

.gacha-skip-btn:hover {
    transform: scale(1.15);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}

/* ==========================================
   CARD REVEAL MODAL
   ========================================== */
.gacha-reveal-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #2d1b3d 0%, #0a0a0a 100%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    cursor: pointer;
    overflow: visible;
}

.gacha-reveal-modal.active {
    display: flex;
}

/* Sparkle background animation */
.gacha-reveal-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(156, 39, 176, 0.3) 0%, transparent 30%),
        radial-gradient(circle at 80% 70%, rgba(233, 30, 99, 0.3) 0%, transparent 30%),
        radial-gradient(circle at 50% 50%, rgba(255, 152, 0, 0.2) 0%, transparent 40%);
    animation: gachaSparkle 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes gachaSparkle {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

.gacha-reveal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    z-index: 1;
}

/* ==========================================
   FLIP CARD - exact copy from gioca.html
   ========================================== */
.gacha-card-wrapper {
    perspective: 1000px;
    overflow: visible;
}

.gacha-flip-card {
    width: clamp(200px, 60vw, 350px);
    aspect-ratio: 0.714;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    cursor: pointer;
    border-radius: 12px;
}

.gacha-flip-card.flipped {
    transform: rotateY(180deg);
}

.gacha-card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(156, 39, 176, 0.3);
}

.gacha-card-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gacha-card-back {
    background: linear-gradient(135deg, #2d1b3d 0%, #1a0d1f 100%);
    overflow: hidden;
}

.gacha-card-front {
    transform: rotateY(180deg);
}

/* Shine effect on card back - before flip only */
.gacha-card-back::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    transform: skewX(-25deg);
    animation: gachaShine 2s ease-in-out infinite;
    pointer-events: none;
    z-index: 10;
}

.gacha-flip-card.flipped .gacha-card-back::after {
    display: none;
}

@keyframes gachaShine {
    0% {
        left: -100%;
    }

    50%,
    100% {
        left: 150%;
    }
}

/* ==========================================
   TAP TEXT
   ========================================== */
.gacha-tap-text {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    text-shadow:
        0 0 20px rgba(156, 39, 176, 0.8),
        0 0 40px rgba(156, 39, 176, 0.5);
    animation: gachaPulse 1.5s ease-in-out infinite;
}

@keyframes gachaPulse {

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

    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

.gacha-tap-text.hidden {
    display: none;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 480px) {
    .gacha-confirm-content {
        padding: 1.5rem;
    }

    .gacha-confirm-buttons {
        flex-direction: column;
    }

    .gacha-confirm-btn {
        width: 100%;
    }
}