/* Lucky Wheel Styles */
.wheel-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: none; /* Changed from flex to none by default, JS will toggle */
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.wheel-modal.active {
    opacity: 1;
    visibility: visible;
    display: flex;
}

.wheel-container {
    position: relative;
    width: 95%;
    max-width: 900px;
    background: linear-gradient(135deg, #b71c1c, #880e4f);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 2px solid #FFD700;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow-y: auto;
}

.wheel-header {
    text-align: center;
    margin-bottom: 20px;
}

.wheel-title {
    font-size: 28px;
    font-weight: bold;
    color: #FFD700;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    font-family: 'Be Vietnam Pro', sans-serif;
}

.wheel-content-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
}

.wheel-section {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.wheel-wrapper {
    position: relative;
    width: 320px;
    height: 320px;
    margin: 0 auto;
}

.wheel-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.wheel-spin-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffeb3b, #fbc02d);
    border: 4px solid #fff;
    color: #d32f2f;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 100; /* Increased z-index */
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto; /* Ensure clickable */
}

/* Ensure SweetAlert2 is on top of Wheel Modal (9999) */
.swal2-container {
    z-index: 10000 !important;
}

.wheel-spin-btn:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.wheel-spin-text {
    font-size: 20px;
    font-weight: 900;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}

.wheel-spin-sub {
    font-size: 11px;
    font-weight: 600;
    color: #c62828;
}

.wheel-spin-btn:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.wheel-history-section {
    flex: 1;
    min-width: 280px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    max-height: 400px;
    display: flex;
    flex-direction: column;
}

.wheel-history-section h3 {
    color: #FFD700;
    font-size: 16px;
    margin-bottom: 12px;
    text-align: center;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.wheel-history-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.wheel-history-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
    color: #fff;
}

.wheel-history-item:last-child {
    border-bottom: none;
}

.wh-user {
    color: #90caf9;
    font-weight: 600;
}

.wh-reward {
    color: #FFD700;
    font-weight: bold;
}

.wh-time {
    color: #aaa;
    font-size: 11px;
}

.wheel-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    opacity: 0.8;
    z-index: 100;
}

.wheel-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Floating Trigger Button */
.wheel-trigger {
    position: fixed;
    bottom: 100px;
    left: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.6);
    z-index: 990;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    animation: bounce 2s infinite;
    border: 2px solid #FFD700;
}

.wheel-trigger i {
    font-size: 28px;
    color: #FFD700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-10px);}
    60% {transform: translateY(-5px);}
}

/* Responsive */
@media (max-width: 768px) {
    .wheel-content-flex {
        flex-direction: column;
        align-items: center;
    }
    .wheel-section, .wheel-history-section {
        width: 100%;
        min-width: unset;
    }
    .wheel-wrapper {
        width: 280px;
        height: 280px;
    }
    .wheel-title {
        font-size: 22px;
    }
}
