/* Random Player Selector - Spinning Wheel Styles */

/* Wheel Animation Keyframes */
@keyframes wheelSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes wheelGlow {
    0% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
    50% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.6); }
    100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
}

@keyframes resultReveal {
    0% { 
        opacity: 0; 
        transform: scale(0.8); 
    }
    50% { 
        opacity: 1; 
        transform: scale(1.1); 
    }
    100% { 
        opacity: 1; 
        transform: scale(1); 
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Wheel Container Styles */
.wheel-container {
    position: relative;
    margin: 20px auto;
    width: 280px;
    height: 280px;
}

/* Wheel container for player (mobile) */
.wheel-popup-overlay .wheel-container {
    width: 260px;
    height: 260px;
}

.wheel-container svg,
.wheel-svg {
    display: block;
    border-radius: 50%;
    filter: drop-shadow(0 0 15px rgba(0, 0, 0, 0.3));
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.4);
    transform-origin: center center;
}

.wheel-container svg.spinning,
.wheel-svg.spinning {
    animation: wheelGlow 0.5s ease-in-out infinite;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.7);
}

/* Wheel outer ring decoration */
.wheel-container::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: #ffd700;
    border-bottom-color: #ffd700;
    z-index: 1;
    pointer-events: none;
}

/* Wheel Pointer - Points DOWN from top of wheel container */
.wheel-pointer {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-top: 28px solid #ffd700;
    z-index: 20;
    filter: drop-shadow(2px 3px 5px rgba(0, 0, 0, 0.6));
    animation: pointerPulse 1.5s ease-in-out infinite;
}

@keyframes pointerPulse {
    0%, 100% { 
        border-top-color: #ffd700;
        filter: drop-shadow(2px 3px 5px rgba(0, 0, 0, 0.6));
    }
    50% { 
        border-top-color: #ffed4e;
        filter: drop-shadow(2px 3px 8px rgba(255, 215, 0, 0.8));
    }
}

/* Wheel Center Hub */
.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 45px;
    height: 45px;
    background: radial-gradient(circle, #ffd700 0%, #ffed4e 50%, #ffc107 100%);
    border-radius: 50%;
    border: 3px solid #333;
    z-index: 15;
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.7), inset 0 0 12px rgba(0,0,0,0.3);
}

/* Winner segment highlighting */
.wheel-segment-winner {
    filter: drop-shadow(0 0 20px gold) brightness(1.3) !important;
    stroke: #ffd700 !important;
    stroke-width: 5px !important;
}

/* Wheel Segments */
.wheel-segment {
    transition: opacity 0.3s ease, filter 0.3s ease;
    cursor: pointer;
}

.wheel-segment:hover {
    opacity: 0.9;
    filter: brightness(1.1);
}

/* Host Control Wheel Status */
#wheelStatus {
    transition: all 0.3s ease;
    border-radius: 10px;
}

#wheelStatus.alert-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border-color: #28a745;
    animation: pulse 0.5s ease-in-out;
}

#wheelStatus.alert-info {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    border-color: #17a2b8;
}

#wheelStatus.alert-warning {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border-color: #ffc107;
}

#wheelStatus.alert-danger {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border-color: #dc3545;
}

/* Wheel Options Display */
#wheelOptions {
    max-height: 150px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ffd700 #333;
}

#wheelOptions::-webkit-scrollbar {
    width: 6px;
}

#wheelOptions::-webkit-scrollbar-track {
    background: #333;
    border-radius: 3px;
}

#wheelOptions::-webkit-scrollbar-thumb {
    background: #ffd700;
    border-radius: 3px;
}

#wheelOptions .badge {
    font-size: 0.85em;
    transition: transform 0.2s ease;
}

#wheelOptions .badge:hover {
    transform: scale(1.05);
}

/* Wheel Control Buttons */
#btnSpinWheel {
    background: linear-gradient(135deg, #28a745, #20c997);
    border: none;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#btnSpinWheel:hover:not(:disabled) {
    background: linear-gradient(135deg, #218838, #17a2b8);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#btnSpinWheel:active:not(:disabled) {
    transform: translateY(0);
}

#btnSpinWheel:disabled {
    background: #6c757d;
    color: #fff;
    opacity: 0.6;
}

/* Spinning Animation for Spin Button */
#btnSpinWheel.spinning::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent);
    animation: buttonShine 1.5s infinite;
}

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

/* Host Display Wheel Result */
#wheelResult {
    animation: resultReveal 0.8s ease-out;
}

#wheelResultText {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    animation: pulse 2s infinite;
}

/* Player Wheel Overlay */
#playerWheelDisplay {
    backdrop-filter: blur(5px);
    animation: fadeIn 0.5s ease-out;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

#playerWheelDisplay .popup-card,
#playerWheelDisplay .wheel-container-outer {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 20px;
    padding: 30px 20px;
    max-width: 95vw;
    width: 100%;
    max-height: 95vh;
    /* overflow-y:auto (was hidden) — safety net so the Spin/Pass controls that sit BELOW the
       3D wheel are reachable by scrolling if the stack ever exceeds 95vh on short screens. */
    overflow: hidden auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(255, 215, 0, 0.3);
}

#playerWheelDisplay .popup-title {
    font-size: 2rem;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    margin-bottom: 15px;
}

#playerWheelDisplay .wheel-3d-wrapper {
    width: 100%;
    margin: 20px auto;
}

/* WHEEL CLICKABILITY FIX (2026-06-23): the shared 3D wheel container defaults to height:70vh
   (wheel-3d.css). On a phone that 70vh wheel + title + status + the Spin/Pass controls (rendered
   BELOW the wheel) overflowed the card's max-height:95vh + overflow:hidden, so the SPIN button was
   clipped off the bottom of the screen and could never be tapped. Cap the wheel on the PLAYER
   overlay so the whole stack (title → wheel → status → Spin/Pass) fits; the card's overflow-y:auto
   above is the fallback. Does NOT touch the backdrop-filter freeze mitigations. */
#playerWheelDisplay .wheel-3d-container {
    height: 48vh;
    height: 48dvh;
}

#wheelDisplay .wheel-3d-wrapper {
    width: 100%;
    margin: 20px auto;
}

#playerWheelDisplay .wheel-message {
    color: #ccc;
    font-size: 1.2rem;
}

#playerWheelDisplay .wheel-assignment-message {
    font-size: 1.3rem;
}

#playerWheelDisplay #btnPlayerSpin,
#playerWheelDisplay #btnPlayerPass {
    min-width: 120px;
    font-size: 1.1rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#playerWheelDisplay .wheel-container {
    animation: scaleIn 0.6s ease-out;
}

@keyframes scaleIn {
    from { 
        transform: scale(0.8); 
        opacity: 0; 
    }
    to { 
        transform: scale(1); 
        opacity: 1; 
    }
}

/* Player Wheel Result */
#playerWheelResult {
    animation: resultReveal 0.8s ease-out;
}

#playerWheelResultText {
    animation: pulse 2s infinite;
}

/* Custom Wheel Creator */
#customWheelCreator {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    border-radius: 10px;
}

#customWheelCreator .card-body {
    background: transparent;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .wheel-container {
        width: 250px !important;
        height: 250px !important;
    }
    
    .wheel-container svg {
        width: 250px !important;
        height: 250px !important;
    }
    
    #wheelOptions {
        max-height: 100px;
    }
    
    #wheelOptions .badge {
        font-size: 0.75em;
        margin: 1px;
        padding: 3px 8px;
    }
}

@media (max-width: 576px) {
    .wheel-container {
        width: 200px !important;
        height: 200px !important;
    }
    
    .wheel-container svg {
        width: 200px !important;
        height: 200px !important;
    }
    
    #wheelDisplay {
        padding: 20px 15px !important;
        margin: 10px !important;
    }
    
    #playerWheelDisplay .text-center {
        padding: 20px 15px !important;
        margin: 10px !important;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .wheel-container svg,
    #wheelResultText,
    #playerWheelResultText,
    .badge {
        animation: none !important;
        transition: none !important;
    }
}

/* Print Styles */
@media print {
    #wheelDisplay,
    #playerWheelDisplay {
        display: none !important;
    }
}
