/* ── SPIN & WHEEL - PREMIUM RESPONSIVE DESIGN ── */

/* Widget Button */
.spin-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9990;
}

.spin-widget-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 18px 32px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.spin-widget-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.spin-widget-btn:hover::before {
    left: 100%;
}

.spin-widget-btn:hover {
    transform: translateY(-5px) scale(1.08);
    box-shadow: 0 15px 50px rgba(102, 126, 234, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.spin-widget-btn i {
    font-size: 22px;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { 
        transform: scale(1); 
        filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
    }
    50% { 
        transform: scale(1.15); 
        filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.8));
    }
}

/* Modal */
.spin-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.spin-modal.active {
    display: flex;
    opacity: 1;
}

.spin-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
}

.spin-modal-content {
    position: relative;
    width: 90%;
    max-width: 650px;
    margin: auto;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.95) 100%);
    border-radius: 40px;
    padding: 40px;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    backdrop-filter: blur(30px);
    transform: scale(0.7) translateY(60px);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    height: auto !important;
    min-height: 0 !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    display: block !important;
}

.spin-modal-content > * {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.spin-modal.active .spin-modal-content {
    transform: scale(1) translateY(0);
}

.spin-modal-close {
    position: absolute;
    top: 25px;
    right: 25px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border: 2px solid rgba(102, 126, 234, 0.2);
    color: #667eea;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
}

.spin-modal-close:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

/* Header */
.spin-header {
    text-align: center;
    margin-bottom: 30px;
}

.spin-header h2 {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: -1px;
}

.spin-header p {
    color: #64748b;
    font-size: 17px;
    font-weight: 500;
}

/* Wheel Container */
.spin-wheel-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto 5px;
}

.spin-wheel-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
}

.spin-wheel-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 0 40px rgba(102, 126, 234, 0.4), 0 0 80px rgba(118, 75, 162, 0.2);
    transition: box-shadow 0.4s ease;
    z-index: 1;
}

.spin-wheel-canvas.spinning {
    box-shadow: 0 0 80px rgba(102, 126, 234, 0.8), 0 0 120px rgba(118, 75, 162, 0.5);
}

/* Wheel Pointer */
.spin-wheel-pointer {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 25px solid transparent;
    border-right: 25px solid transparent;
    border-top: 50px solid #667eea;
    background: linear-gradient(135deg, #667eea, #764ba2);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    filter: drop-shadow(0 6px 15px rgba(0, 0, 0, 0.4));
    z-index: 10;
}

.spin-wheel-pointer::after {
    content: '';
    position: absolute;
    top: -45px;
    left: -15px;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 30px solid white;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.2));
}

/* Spin Button */
.spin-btn-container {
    text-align: center;
    margin-top: 5px;
}

.spin-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 20px 60px;
    font-size: 19px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 35px rgba(102, 126, 234, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    letter-spacing: 3px;
    position: relative;
    overflow: hidden;
    z-index: 100;
    pointer-events: auto;
}

.spin-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s ease;
}

.spin-btn:hover::before {
    left: 100%;
}

.spin-btn:hover:not(:disabled) {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 45px rgba(102, 126, 234, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.spin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Make sure hidden stages truly collapse instead of reserving space */
[hidden], .hidden {
    display: none !important;
}

/* Wheel Screen */
#spinWheelScreen {
    display: block;
}

#spinWheelScreen.hidden {
    display: none !important;
}

/* Result Screen */
.spin-result-screen {
    display: none;
    text-align: center;
    padding: 20px 0;
}

.spin-result-screen.active {
    display: block;
    animation: fadeInUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spin-result-icon {
    font-size: 90px;
    margin-bottom: 25px;
    animation: bounce-glow 1.2s ease-in-out infinite;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes bounce-glow {
    0%, 100% { 
        transform: translateY(0) scale(1); 
        filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.3));
    }
    50% { 
        transform: translateY(-25px) scale(1.05); 
        filter: drop-shadow(0 0 25px rgba(102, 126, 234, 0.6));
    }
}

.spin-result-title {
    font-size: 30px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    letter-spacing: -0.5px;
}

.spin-result-discount {
    font-size: 56px;
    font-weight: 900;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 25px 0;
    letter-spacing: -2px;
}

.spin-coupon-container {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 3px dashed #667eea;
    border-radius: 20px;
    padding: 25px;
    margin: 25px 0;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.15);
}

.spin-coupon-code {
    font-size: 26px;
    font-weight: 800;
    color: #667eea;
    letter-spacing: 4px;
    background: white;
    padding: 18px 30px;
    border-radius: 15px;
    display: inline-block;
    margin: 15px 0;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(102, 126, 234, 0.1);
}

.spin-coupon-actions {
    display: flex;
    gap: 18px;
    justify-content: center;
    margin-top: 25px;
    flex-wrap: wrap;
}

.spin-coupon-actions button {
    padding: 14px 35px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    font-size: 15px;
    letter-spacing: 0.5px;
}

.spin-copy-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.spin-copy-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 35px rgba(16, 185, 129, 0.6);
}

.spin-apply-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.spin-apply-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.6);
}

.spin-continue-btn {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(107, 114, 128, 0.4);
}

.spin-continue-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 35px rgba(107, 114, 128, 0.6);
}

/* Loading State */
.spin-loading {
    display: none;
    text-align: center;
    padding: 40px;
}

.spin-loading.active {
    display: block;
}

.spin-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Confetti */
.spin-confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 5;
}

.spin-confetti {
    position: absolute;
    width: 12px;
    height: 12px;
    animation: confetti-fall 3.5s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Error State */
.spin-error {
    display: none;
    text-align: center;
    padding: 30px;
    color: #ef4444;
}

.spin-error.active {
    display: block;
}

.spin-error-icon {
    font-size: 60px;
    margin-bottom: 15px;
}

.spin-error-message {
    font-size: 18px;
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .spin-widget {
        bottom: 20px;
        right: 16px;
    }
    
    .spin-modal-content {
        padding: 35px 25px;
        width: 95%;
        border-radius: 30px;
    }
    
    .spin-header h2 {
        font-size: 26px;
    }
    
    .spin-header p {
        font-size: 15px;
    }
    
    .spin-wheel-container {
        max-width: 320px;
        margin-bottom: 30px;
    }
    
    .spin-result-icon {
        font-size: 70px;
    }
    
    .spin-result-title {
        font-size: 24px;
    }
    
    .spin-result-discount {
        font-size: 42px;
    }
    
    .spin-coupon-code {
        font-size: 20px;
        padding: 14px 25px;
        letter-spacing: 3px;
    }
    
    .spin-coupon-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .spin-coupon-actions button {
        width: 100%;
        padding: 16px 30px;
    }
    
    .spin-btn {
        padding: 18px 50px;
        font-size: 17px;
    }
}

@media (max-width: 480px) {
    .spin-widget {
        bottom: 16px;
        right: 12px;
    }
    
    .spin-widget-btn {
        padding: 10px 18px;
        font-size: 13px;
        gap: 6px;
    }
    
    .spin-widget-btn i {
        font-size: 16px;
    }
    
    .spin-modal-content {
        padding: 30px 20px;
        width: 92%;
    }
    
    .spin-wheel-container {
        max-width: 280px;
    }
    
    .spin-result-discount {
        font-size: 36px;
    }
    
    .spin-coupon-code {
        font-size: 18px;
        padding: 12px 20px;
    }
}
