/* Lottery Spinner for Chat Loading */
.lottery-spinner-container {
    display: none;
    position: relative;
    width: 100%;
    padding: 20px;
    text-align: center;
    margin: 0 auto;
    margin-bottom: 10px;
    animation: fadeIn 0.3s ease-out;

    /* Center in viewport but moved up by 25% */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -200%);
    z-index: 1000;
}

.lottery-spinner {
    position: relative;
    width: 220px;
    height: 220px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    perspective: 1000px;
}

/* Center text "Generating numbers..." */
.lottery-spinner-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.95rem;
    font-weight: 500;
    color: #5B3E90;
    text-align: center;
    width: 100%;
    z-index: 10;
    background: rgba(255, 255, 255, 0.7);
    padding: 5px;
    border-radius: 50px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
}

/* Rotating lottery balls */
.lottery-ball-spinner {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2),
               inset 0 -3px 10px rgba(0, 0, 0, 0.3),
               inset 0 5px 15px rgba(255, 255, 255, 0.5);
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 22px;
    animation-name: orbitAndColor;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
}

/* Different balls with different colors and numbers */
.lottery-ball-spinner:nth-child(1) {
    background: radial-gradient(circle at 35% 35%, #FF5C5C 0%, #D80000 60%, #8D0000 100%);
    animation-duration: 2s;
    transform: translate(0, -80px);
}

.lottery-ball-spinner:nth-child(2) {
    background: radial-gradient(circle at 35% 35%, #5B86E5 0%, #36D1DC 60%, #1A91D1 100%);
    animation-duration: 2.3s;
    transform: translate(70px, -40px);
}

.lottery-ball-spinner:nth-child(3) {
    background: radial-gradient(circle at 35% 35%, #F7D046 0%, #FF9500 60%, #F28500 100%);
    animation-duration: 2.6s;
    transform: translate(70px, 40px);
}

.lottery-ball-spinner:nth-child(4) {
    background: radial-gradient(circle at 35% 35%, #38EF7D 0%, #11998E 60%, #08776E 100%);
    animation-duration: 2.9s;
    transform: translate(0, 80px);
}

.lottery-ball-spinner:nth-child(5) {
    background: radial-gradient(circle at 35% 35%, #8E2DE2 0%, #4A00E0 60%, #3900B5 100%);
    animation-duration: 3.2s;
    transform: translate(-70px, 40px);
}

.lottery-ball-spinner:nth-child(6) {
    background: radial-gradient(circle at 35% 35%, #FD746C 0%, #FF9068 60%, #D35E30 100%);
    animation-duration: 3.5s;
    transform: translate(-70px, -40px);
}

/* Animation for the lottery balls */
@keyframes orbitAndColor {
    0% {
        transform-origin: center;
        transform: rotate(0deg) translate(80px) rotate(0deg);     
    }
    100% {
        transform-origin: center;
        transform: rotate(360deg) translate(80px) rotate(-360deg);
    }
}

/* Pulsing effect for the text */
@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

.lottery-spinner-text {
    animation: pulse 1.5s infinite;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Add backdrop for better visibility */
.lottery-spinner-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 999;
    display: none;
}

/* Show backdrop when spinner is shown */
.lottery-spinner-container.show ~ .lottery-spinner-backdrop {     
    display: block;
}

/* Override position for the specific lottery-spinner ID to move it 3rem down */
#lottery-spinner {
    transform: translate(-50%, calc(-200% + 11rem));
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .lottery-spinner {
        width: 180px;
        height: 180px;
    }

    .lottery-ball-spinner {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .lottery-ball-spinner:nth-child(1) { transform: translate(0, -65px); }
    .lottery-ball-spinner:nth-child(2) { transform: translate(55px, -30px); }
    .lottery-ball-spinner:nth-child(3) { transform: translate(55px, 30px); }
    .lottery-ball-spinner:nth-child(4) { transform: translate(0, 65px); }
    .lottery-ball-spinner:nth-child(5) { transform: translate(-55px, 30px); }
    .lottery-ball-spinner:nth-child(6) { transform: translate(-55px, -30px); }
    @keyframes orbitAndColor {
        0% {
            transform-origin: center;
            transform: rotate(0deg) translate(65px) rotate(0deg); 
        }
        100% {
            transform-origin: center;
            transform: rotate(360deg) translate(65px) rotate(-360deg);
        }
    }
}