

@keyframes lightPulse {
    0%, 100% {
        filter: drop-shadow(0 0 0px #fcf99a);
    }
    50% {
        filter: drop-shadow(0 0 7px #fcf99a);
    }
}

/* Machine Animation Component Styles */
.machine {
    width: 430px;
    height: 352px;
    margin-top: -28px;
    position: relative;
}

.machine::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('/modules/kingjourney/images/spin-machine/lottery-machine.avif');
    background-repeat: no-repeat;
    background-size: contain;
    animation: lightPulse 2s infinite;
    z-index: 0;
    pointer-events: none;
}

.machine__wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 430px;
    height: 308px;
    padding: 0 60px;
    padding-top: 29px;
    position: relative;
    z-index: 1;
    isolation: isolate;
}

.machine__wrap * {
    position: relative;
    z-index: 2;
}

.machine__title {
    margin-bottom: 37px;
    height: 24px;
    z-index: 2;
}

.machine__title img {
    height: 100%;
}

.machine__animation {
    margin-bottom: 14px;
}

.machine__ticket-quantity {
    width: 141px;
    height: 39px;
    margin-bottom: 36px;
}

.machine__ticket-quantity .form-input {
    background-color: transparent;
    padding: 0;
    border: none;
}

.machine__ticket-quantity .form-input input,
.machine__ticket-quantity .ticket-input {
    height: 39px !important;
    width: 100%;
    text-align: center;
    background: #01342a !important;
    color: #ffffff;
    border-radius: 5px;
    border: none !important;
    min-height: 39px !important;
    font-size: 14px;
    padding: 0 10px;
    box-sizing: border-box;
}

.machine__ticket-quantity .form-input input::placeholder,
.machine__ticket-quantity .ticket-input::placeholder {
    font-weight: 500;
    line-height: 20px;
    text-align: center;
    color: #a9b3aa;
    font-size: 14px !important;
}

.machine__ticket-quantity .form-input input:disabled,
.machine__ticket-quantity .ticket-input:disabled {
    color: #A9B3A9;
    background: #013426 !important;
}

.machine__ticket-quantity .form-input input:disabled::placeholder,
.machine__ticket-quantity .ticket-input:disabled::placeholder {
    color: #0c725e;
}

.machine__btn-quantity .button-wrap {
    display: flex;
    column-gap: 12px;
}

.machine__btn-quantity .button-item {
    width: 67.02px;
    height: 42.89px;
    cursor: pointer;
}

.machine__btn-quantity .button-item.disabled {
    pointer-events: none;
}

.machine__btn-quantity .button-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.machine__button {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    column-gap: 22px;
    padding-right: 36px;
    margin-top: -20px;
    position: relative;
    z-index: 3;
    isolation: isolate;
}

.machine__button .major-btn {
    width: 179px;
    height: 61px;
    cursor: pointer;
}

.machine__button .btn-skip {
    width: 67.02px;
    height: 42.08px;
    cursor: pointer;
    margin-bottom: -4px;
}

.machine__button .major-btn img,
.machine__button .btn-skip img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.machine__button .btn-skip.disabled,
.machine__button .major-btn.disabled {
    cursor: not-allowed !important;
}

/* Mobile responsiveness */
@media (max-width: 1199px) {
    .machine {
        width: 375px;
        height: 332px;
        margin-top: 0;
    }

    .machine::before {
        width: 100%;
        height: 100%;
    }

    .machine__wrap {
        width: 375px;
        height: 268px;
        padding-top: 25px;
    }

    .machine__title {
        height: 21px;
        margin-bottom: 32.5px;
    }

    .machine__button {
        column-gap: 18px;
        margin-top: -18px;
    }

    .machine__animation {
        margin-bottom: 11.5px;
    }

    .machine__ticket-quantity {
        width: 127px;
        height: 34px;
        margin-bottom: 32px;
    }

    .machine__ticket-quantity .form-input input,
    .machine__ticket-quantity .ticket-input {
        height: 34px !important;
        min-height: 34px !important;
        padding-left: 4px !important;
        padding-right: 4px !important;
        font-size: 12px !important;
    }

    .machine__ticket-quantity .form-input input::placeholder,
    .machine__ticket-quantity .ticket-input::placeholder {
        font-size: 12px !important;
    }

    .machine__btn-quantity {
        height: 37px;
        width: 268px;
    }

    .machine__btn-quantity .button-wrap {
        column-gap: 12px;
        justify-content: space-between;
    }

    .machine__btn-quantity .button-item {
        width: 58px;
        height: 37px;
    }

    .machine__button .major-btn {
        width: 156px;
        height: 54px;
    }

    .machine__button .btn-skip {
        width: 58px;
        height: 37px;
    }
}

/* Loading state */
.machine.loading {
    pointer-events: none;
    opacity: 0.7;
}

.machine.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Animation effects */
.machine__button .major-btn:hover:not(.disabled),
.machine__button .btn-skip:hover:not(.disabled) {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

.machine__btn-quantity .button-item:hover:not(.disabled) {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

/* Focus states for accessibility */
.machine__ticket-quantity .ticket-input:focus {
    outline: 2px solid #fcf99a;
    outline-offset: 2px;
}

/* Error states */
.machine__ticket-quantity .ticket-input.error {
    border: 2px solid #ff4444 !important;
}

.machine__ticket-quantity .error-message {
    color: #ff4444;
    font-size: 12px;
    margin-top: 4px;
    text-align: center;
}

/* Success states */
.machine__ticket-quantity .ticket-input.success {
    border: 2px solid #44ff44 !important;
}

/* Spin animation */


/* Blur & Motion Effects for Machine Container */
.machine.spinning {
    animation: machineShakeGlowMachine 2s ease-in-out;
}

@keyframes machineShakeGlowMachine {
    0%, 100% {
        transform: translateX(0) scale(1);
        filter: drop-shadow(0 0 5px #fcf99a) brightness(1);
    }
    5% {
        transform: translateX(-3px) scale(1.01);
        filter: drop-shadow(0 0 5px #fcf99a) brightness(1.02);
    }
    10% {
        transform: translateX(3px) scale(1.02);
        filter: drop-shadow(0 0 5px #fcf99a) brightness(1.04);
    }
    15% {
        transform: translateX(-3px) scale(1.015);
        filter: drop-shadow(0 0 5px #fcf99a) brightness(1.03);
    }
    20% {
        transform: translateX(3px) scale(1.01);
        filter: drop-shadow(0 0 5px #fcf99a) brightness(1.02);
    }
    50% {
        transform: translateX(0) scale(1.03);
        filter: drop-shadow(0 0 5px #fcf99a) brightness(1.05);
    }
    80% {
        transform: translateX(0) scale(1.02);
        filter: drop-shadow(0 0 5px #fcf99a) brightness(1.03);
    }
}

@keyframes machineShakeGlow {
    0%, 100% {
        transform: translateX(0) scale(1);
        filter: drop-shadow(0 0 8px rgba(252, 249, 154, 0.4));
    }
    5% {
        transform: translateX(-3px) scale(1.01);
        filter: drop-shadow(0 0 12px rgba(252, 249, 154, 0.6));
    }
    10% {
        transform: translateX(3px) scale(1.02);
        filter: drop-shadow(0 0 16px rgba(252, 249, 154, 0.8));
    }
    15% {
        transform: translateX(-3px) scale(1.01);
        filter: drop-shadow(0 0 12px rgba(252, 249, 154, 0.6));
    }
    20% {
        transform: translateX(3px) scale(1);
        filter: drop-shadow(0 0 8px rgba(252, 249, 154, 0.4));
    }
    50% {
        transform: translateX(0) scale(1.03);
        filter: drop-shadow(0 0 20px rgba(252, 249, 154, 0.9));
    }
    80% {
        transform: translateX(0) scale(1.02);
        filter: drop-shadow(0 0 15px rgba(252, 249, 154, 0.7));
    }
}

@keyframes lightPulseIntense {
    0% {
        filter: drop-shadow(0 0 5px #fcf99a) brightness(1);
    }
    100% {
        filter: drop-shadow(0 0 20px #fcf99a) brightness(1.1);
    }
}

@keyframes neonBorder {
    0%, 100% {
        box-shadow: 0 0 5px rgba(252, 249, 154, 0.5);
    }
    50% {
        box-shadow: 0 0 25px rgba(252, 249, 154, 0.9),
                    0 0 35px rgba(252, 249, 154, 0.7),
                    0 0 45px rgba(252, 249, 154, 0.5);
    }
}

/* Button fade effects during spinning */
.machine.spinning .major-btn,
.machine.spinning .btn-skip {
    animation: buttonFadeBlur 1.5s ease-in-out;
}

@keyframes buttonFadeBlur {
    0%, 100% {
        opacity: 1;
        filter: blur(0px);
    }
    25% {
        opacity: 0.7;
        filter: blur(1px);
    }
    50% {
        opacity: 0.5;
        filter: blur(2px);
    }
    75% {
        opacity: 0.7;
        filter: blur(1px);
    }
}

/* Turn buttons motion blur during spinning */
.machine.spinning .machine__btn-quantity .button-item {
    animation: turnButtonPulse 1.5s ease-in-out;
}

@keyframes turnButtonPulse {
    0%, 100% {
        transform: scale(1);
        filter: blur(0px);
        opacity: 1;
    }
    50% {
        transform: scale(0.98);
        filter: blur(1px);
        opacity: 0.8;
    }
}

/* Input field blur effect */
.machine.spinning .ticket-input {
    animation: inputBlur 1.5s ease-in-out;
}

@keyframes inputBlur {
    0%, 100% {
        filter: blur(0px);
        opacity: 1;
    }
    50% {
        filter: blur(1px);
        opacity: 0.9;
    }
}

/* Jackpot glow effect */
@keyframes jackpotGlow {
    0%, 100% { box-shadow: 0 0 5px #fcf99a; }
    50% { box-shadow: 0 0 20px #fcf99a, 0 0 30px #fcf99a; }
}

.machine.jackpot {
    animation: jackpotGlow 1s ease-in-out infinite;
}

/* GPU Optimization for Blur & Motion Effects */
.machine {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.number-wheel {
    will-change: transform, filter, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.machine__animation {
    will-change: transform;
    transform: translateZ(0);
}

.major-btn, .btn-skip, .button-item {
    will-change: transform, filter, opacity;
    transform: translateZ(0);
}

.ticket-input {
    will-change: filter, opacity;
    transform: translateZ(0);
}
