/* CSS Styles for Sliding Symbol Slot Machine */

/* Reels Container */
.sprite-reels-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px; /* Fixed gap between reels */
    background: #1a1a1a;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #333;
    width: fit-content; /* Size to content, not full width */
    max-width: 100%; /* Don't exceed container */
    margin: 2px auto;
    box-sizing: border-box;
    position: relative;
}

/* Individual Reel - FIXED 150px width for perfect alignment */
.reel {
    width: 150px; /* FIXED WIDTH - never changes */
    height: 450px; /* FIXED HEIGHT - 3 symbols × 150px = 450px */
    overflow: hidden; /* CRITICAL: Hide symbols outside the window */
    background: #333;
    border-radius: 3px;
    position: relative;
    border: 2px solid #222;
    
    /* Sprite background setup - exact pixel matching */
    background-image: url('sprite_reel_vertical.png');
    background-size: 150px 1500px; /* Exact sprite size - 150px wide, 1500px tall */
    background-repeat: repeat-y;
    background-position: 0 0;
}

/* Depth shading overlay - creates illusion of deep reel cylinder */
.reel::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 5;
    
    /* Gradient shadows to simulate depth - darker at edges, transparent in center */
    background: linear-gradient(to bottom,
        rgba(0, 0, 0, 0.5) 0%,
        rgba(0, 0, 0, 0.3) 15%,
        rgba(0, 0, 0, 0.08) 30%,
        rgba(0, 0, 0, 0) 40%,
        rgba(0, 0, 0, 0) 60%,
        rgba(0, 0, 0, 0.08) 70%,
        rgba(0, 0, 0, 0.3) 85%,
        rgba(0, 0, 0, 0.5) 100%
    );
    
    /* Additional side shading for cylindrical depth */
    box-shadow: 
        inset 8px 0 12px -8px rgba(0, 0, 0, 0.4),
        inset -8px 0 12px -8px rgba(0, 0, 0, 0.4);
}

/* Spinning animation - CSS animation for smooth looping */
.reel.spinning {
    animation: spinReel 0.1s linear infinite;
}

@keyframes spinReel {
    0% { background-position: 0 0; }
    100% { background-position: 0 -1500px; }
}

/* Non-spinning reels - smooth transition to final position */
.reel:not(.spinning) {
    transition: background-position 0.3s ease-out;
}

/* Video Reels Container - Natural Video Size */
.video-reels-container {
    display: flex;
    width: fit-content;
    margin: 0 auto;
    background: transparent;
    position: relative; /* For absolute positioning of overlay */
}

/* Individual Video Reel - Natural Width */
.video-reel {
    width: auto;
    height: auto;
    overflow: visible;
}

/* Video Elements - Natural Size */
.video-reel video {
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Glass Overlay with Realistic 3D Effect */
.slot-glass-overlay {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 150px; /* One symbol height */
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 10;
    
    /* Glass effect with subtle 3D shading */
    background: linear-gradient(to bottom,
        rgba(255, 255, 255, 0.15) 0%,
        rgba(255, 255, 255, 0.08) 20%,
        rgba(255, 255, 255, 0.03) 50%,
        rgba(255, 255, 255, 0.08) 80%,
        rgba(255, 255, 255, 0.15) 100%
    );
    
    /* More visible glass borders */
    border-top: 2px solid rgba(255, 255, 255, 0.6);
    border-bottom: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 0 rgba(255, 255, 255, 0.4),
        0 3px 6px rgba(0, 0, 0, 0.2);
}

/* More visible center reference line */
.center-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.4);
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 3px rgba(255, 255, 255, 0.3);
    z-index: 11;
    pointer-events: none;
}

/* Separators Between Reels - Thin Green Lines */
.reel-separator {
    width: 2px;
    height: 388px;
    background: #2d5a2d;
}

/* Control Panel - HTML Table Layout */
.control-panel {
    background: #2c3e50;
    color: white;
    border-radius: 8px;
    margin: 0 auto; /* Center like the reels container */
    width: fit-content; /* Match reels container width behavior */
    height: 80px; /* Fixed height for the control panel */
    min-width: 534px; /* Match reels container width (450px + 2×20px padding + 2×2px border) */
    box-sizing: border-box;
    padding: 10px;
}

.control-table {
    width: 100%;
    height: 100%;
    border-collapse: collapse;
    table-layout: auto; /* Let columns size naturally */
    display: table;
}

.control-table tr {
    display: table-row;
    height: 100%; /* Single row takes full height */
}

.control-table td {
    display: table-cell;
    text-align: center;
    vertical-align: middle;
    padding: 4px 8px;
    border: none;
    border-right: 4px solid #304357; /* Even wider vertical separator with background color */
    background: #1a1a1a; /* Match reels container background */
}

/* Remove right border from last cell */
.control-table td:last-child {
    border-right: none;
}

/* Column widths - optimized for dynamic content */
.control-table td:nth-child(1) { width: auto; min-width: 60px; } /* WIN - can expand for big wins */
.control-table td:nth-child(2) { width: auto; min-width: 80px; } /* COINS - can expand for high balances */
.control-table td:nth-child(3) { width: auto; min-width: 50px; } /* BET - minimal space */
.control-table td:nth-child(4) { width: 60px; max-width: 60px; } /* NARROW ARROWS - fixed small */
.control-table td:nth-child(5) { width: auto; max-width: 150px; } /* SPIN - can shrink to make room */

.spin-cell {
    vertical-align: middle;
}

.spin-cell .spin-button {
    height: 56px;
    min-width: 140px; /* Twice as wide as before, but can shrink if needed */
    width: auto; /* Allow natural sizing */
    margin: 0 auto;
}

/* BET cell - right aligned to get close to arrows */
.bet-cell {
    text-align: right !important;
    padding-right: 4px !important;
}

/* Narrow arrow cell styling - left aligned */
.narrow-arrow-cell {
    width: 60px !important;
    padding: 2px;
    text-align: left !important;
    padding-left: 4px !important;
}

.narrow-arrow-cell .bet-btn-inline {
    width: 32px;
    height: 26px;
    margin: -.5em 0; /* Negative margin to overlap and reduce overall height */
    font-size: 0.9rem;
}

.control-label {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: bold;
    color: #ecf0f1;
    margin: 0;
    line-height: 1;
}

.control-value {
    display: inline-block;
    font-size: 1.4rem;
    font-weight: bold;
    color: #f1c40f;
    transition: all 0.3s ease;
    margin: 0;
    line-height: 1;
}

/* Winning number animation */
.control-value.winning {
    font-size: 2rem;
    color: #2ecc71;
    text-shadow: 0 0 10px #2ecc71;
    animation: winPulse 0.6s ease-in-out;
}

@keyframes winPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Credit counter animation */
.control-value.counting {
    color: #f39c12;
    text-shadow: 0 0 5px #f39c12;
    animation: countUp 0.1s ease-in-out;
}

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

/* Spin Button */
.spin-button {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0 25px; /* Remove vertical padding, use height instead */
    height: 56px; /* Almost full height of control panel (60px - 4px clearance) */
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spin-button:hover {
    background: #c0392b;
}

.spin-button:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

/* Bet Label and Controls - Inline Layout */
.bet-label-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.bet-arrows {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bet-btn-inline {
    background: #3498db;
    color: white;
    border: none;
    width: 20px;
    height: 16px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.6rem;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.bet-btn-inline:hover {
    background: #2980b9;
}

/* Bet Table Buttons - for 2-row layout */
.bet-btn-table {
    background: #3498db;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.bet-btn-table:hover {
    background: #2980b9;
}

/* Action Buttons Row */
.action-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
    width: 100%;
}

.action-buttons .flip-button,
.action-buttons .claim-button {
    flex: 1;
    max-width: 200px;
    min-width: 120px;
}

/* Slot Machine Container - Full width with centered content */
.slot-machine-container {
    width: 100%; /* Fill the full width of the center column */
    background: linear-gradient(135deg, #2c3e50, #34495e);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center; /* Center the slot machine content within the full-width container */
}

/* Win animation effects */
.win-animation {
    animation: winPulseEnhanced 1.5s ease-out;
    color: #ffaa00 !important;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

@keyframes winPulseEnhanced {
    0% {
        transform: scale(1);
        color: #ffaa00;
    }
    25% {
        transform: scale(1.3);
        color: #ffdd00;
    }
    50% {
        transform: scale(1.1);
        color: #ffff00;
    }
    75% {
        transform: scale(1.2);
        color: #ffcc00;
    }
    100% {
        transform: scale(1);
        color: #ffaa00;
    }
}

/* Coin drop effects */
.coin-effect {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    font-size: 20px;
    animation: coinFall 1s ease-in forwards;
}

@keyframes coinFall {
    0% {
        transform: translateY(0px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100px) rotate(360deg);
        opacity: 0;
    }
}

/* Enhanced number display for better visibility */
#last-win {
    font-size: 2em;
    font-weight: bold;
    color: #00ff00;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    transition: all 0.3s ease;
}

/* Pulse effect for balance updates */
.balance-update {
    animation: balancePulse 0.8s ease-out;
}

@keyframes balancePulse {
    0% {
        transform: scale(1);
        color: inherit;
    }
    50% {
        transform: scale(1.1);
        color: #00ff00;
    }
    100% {
        transform: scale(1);
        color: inherit;
    }
}


/* Claim Section - Horizontal Layout */
.claim-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
}

/* Credits Display in Claim Section - Single Line */
.credits-display {
    display: flex;
    align-items: center;
    min-width: 120px;
}

.credits-display .control-label {
    font-size: 1rem;
    font-weight: bold;
    color: #ecf0f1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.credits-display .control-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #f1c40f;
    text-shadow: 0 0 5px rgba(241, 196, 15, 0.5);
    transition: all 0.3s ease;
}

/* Claim Button */
.claim-button {
    background: #27ae60;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
    text-align: center;
}

.claim-button:hover:not(:disabled) {
    background: #229954;
}

.claim-button:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

/* Hide win overlay for now */
.win-overlay {
    display: none;
}

/* Enable flip button */
.flip-button {
    display: block;
    background: #f39c12;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin: 10px 0;
}

/* Slot Machine Flip Animation */
.slot-machine {
    position: relative;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.slot-machine.flipped {
    transform: rotateY(180deg);
}

.machine-front,
.machine-back {
    position: relative;
    backface-visibility: hidden;
}

.machine-back {
    transform: rotateY(180deg);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Prize Display Container */
.prize-display-container {
    width: 100%;
    max-width: 534px; /* Match slot machine width */
    height: 494px; /* Match reel container height (450px + 2×20px padding + 2×2px border) */
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #1a1a1a; /* Match reel container background */
    border-radius: 10px;
    border: 2px solid #333;
}

/* Prize Table Styles */
.prize-table {
    width: 100%;
    background: #2c3e50;
    color: white;
    border-radius: 10px;
    border-collapse: collapse;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.prize-table thead {
    background: #34495e;
}

.prize-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: bold;
    color: #ecf0f1;
    font-size: 0.9rem;
    border: none;
}

.prize-table tbody tr {
    border-bottom: 1px solid #34495e;
    transition: background-color 0.2s ease;
}

.prize-table tbody tr:hover {
    background: rgba(52, 73, 94, 0.5);
}

.prize-table tbody tr:last-child {
    border-bottom: none;
}

.prize-table td {
    padding: 10px 8px;
    text-align: center;
    border: none;
}

.prize-image {
    font-size: 1.8rem;
    line-height: 1;
}

.prize-label {
    font-weight: bold;
    color: #ecf0f1;
    font-size: 0.9rem;
}

.prize-combo {
    font-size: 1.2rem;
    line-height: 1;
    letter-spacing: 2px;
}

.prize-payout {
    font-weight: bold;
    color: #f1c40f;
    font-size: 0.95rem;
}

/* Flip Button Styles */
.flip-button {
    background: #f39c12;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.flip-button:hover {
    background: #e67e22;
}

.flip-button:active {
    transform: scale(0.98);
}

/* Responsive Media Queries for Control Panel */
/* Since slot machine minimum width is 450px, optimize around that constraint */

@media (max-width: 600px) {
    .control-panel {
        /* Stay horizontal but reduce gaps for better space usage */
        gap: 10px;
    }
    
    .sprite-reels-container {
        gap: 15px;
        padding: 15px;
    }
}

@media (max-width: 500px) {
    .control-panel {
        /* Only go vertical when really necessary, well above 450px limit */
        flex-direction: column;
        gap: 12px;
        min-width: 450px; /* Enforce minimum to match slot machine */
    }
    
    .sprite-reels-container {
        gap: 10px;
        padding: 10px;
    }
}
