/* ============================================================================
   POKER-STYLE LOTTERY - 36 CARDS (6×6 GRID)
   ============================================================================ */

/* Hide any forms/content outside the modal - keep page clean! */
.lottery-container > form,
.lottery-container > .form-group,
.lottery-container > .lottery-checkbox-container,
.lottery-container > .half-column,
.lottery-container > .instructions-container {
    display: none !important;
}

/* Only show form inside modal */
#lottery-modal form,
#lottery-modal .form-group,
#lottery-modal .lottery-checkbox-container {
    display: block !important;
}

/* Container */
.lottery-container {
    text-align: center;
    font-family: Arial, sans-serif;
    max-width: 1040px;
    margin: 60px auto !important;
    background: white;
    padding: 15px;
    border-radius: 0;
}

/* Seed Hash Display (Provably Fair Commitment) */
.seed-hash-display {
    background: #f0f8ff;
    border: 2px solid #1e73be;
    border-radius: 8px;
    padding: 15px;
    margin: 20px auto 30px;
    max-width: 600px;
}

.seed-hash-display h4 {
    margin: 0 0 10px 0;
    color: #1e73be;
    font-size: 16px;
}

.seed-details-toggle {
    display: inline-block;
    margin-top: 6px;
    padding: 6px 12px;
    border: 1px solid #1e73be;
    background: #fff;
    color: #1e73be;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.seed-details {
    margin-top: 10px;
}

.verify-draw-link {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    background: #1e73be;
    color: #fff;
    text-decoration: none;
    font-size: 12px;
}

.seed-hash-value {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    word-break: break-all;
    background: white;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* 36-Card Grid (6×6) */
#poker-card-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    margin: 30px auto;
    width: 90%;
    max-width: 600px;
}

/* Individual Card */
.poker-card {
    width: 100%;
    aspect-ratio: 0.7; /* Playing card proportions */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 3px solid #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer; /* Clickable! */
}

.poker-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

/* Selected State - Highly Visible */
.poker-card.selected {
    border: 5px solid #00ff00 !important;
    box-shadow: 
        0 0 0 3px #ffffff,
        0 0 25px rgba(0, 255, 0, 0.8),
        0 0 50px rgba(0, 255, 0, 0.4),
        inset 0 0 30px rgba(0, 255, 0, 0.3) !important;
    transform: translateY(-10px) scale(1.08);
    animation: selectedPulse 1s ease-in-out infinite;
    z-index: 10;
}

@keyframes selectedPulse {
    0%, 100% {
        box-shadow: 
            0 0 0 3px #ffffff,
            0 0 25px rgba(0, 255, 0, 0.8),
            0 0 50px rgba(0, 255, 0, 0.4),
            inset 0 0 30px rgba(0, 255, 0, 0.3);
    }
    50% {
        box-shadow: 
            0 0 0 5px #ffffff,
            0 0 35px rgba(0, 255, 0, 1),
            0 0 70px rgba(0, 255, 0, 0.6),
            inset 0 0 40px rgba(0, 255, 0, 0.5);
    }
}

/* Large checkmark badge for selected cards */
.poker-card.selected .card-selected-badge {
    display: flex !important;
}

/* Add selected badge via CSS content - shows on top of card */
.poker-card.selected::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #00cc00, #00ff00);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 32px;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    border: 3px solid white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Card Face Down State - Classic Playing Card Back */
.poker-card.face-down {
    background: #b22222; /* Deep red base */
    overflow: hidden;
}

/* Outer border frame */
.poker-card.face-down::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border: 2px solid #ffd700;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Inner pattern area with diamond pattern */
.poker-card.face-down::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 8px;
    right: 8px;
    bottom: 10px;
    background: 
        /* Diamond pattern layer */
        linear-gradient(45deg, transparent 40%, #ffd700 40%, #ffd700 42%, transparent 42%),
        linear-gradient(-45deg, transparent 40%, #ffd700 40%, #ffd700 42%, transparent 42%),
        linear-gradient(45deg, transparent 58%, #ffd700 58%, #ffd700 60%, transparent 60%),
        linear-gradient(-45deg, transparent 58%, #ffd700 58%, #ffd700 60%, transparent 60%),
        /* Base diamond fill */
        repeating-linear-gradient(
            45deg,
            #8b0000 0px,
            #8b0000 8px,
            #a52a2a 8px,
            #a52a2a 16px
        ),
        #b22222;
    background-size: 20px 20px, 20px 20px, 20px 20px, 20px 20px, 16px 16px, 100% 100%;
    border-radius: 2px;
}

/* Center emblem overlay */
.poker-card.face-down .card-back-emblem {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40%;
    height: 50%;
    background: 
        radial-gradient(ellipse at center, #ffd700 0%, #ffd700 30%, transparent 30%),
        radial-gradient(ellipse at center, #8b0000 35%, transparent 35%);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Card Face Up State */
.poker-card.face-up {
    background: white;
    border-color: #333;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.poker-card .card-rank {
    font-size: 32px;
    font-weight: bold;
    line-height: 1;
}

.poker-card .card-suit {
    font-size: 28px;
    line-height: 1;
}

/* Suit Colors */
.poker-card.suit-hearts .card-suit,
.poker-card.suit-diamonds .card-suit {
    color: #dc2626; /* Red */
}

.poker-card.suit-spades .card-suit,
.poker-card.suit-clubs .card-suit {
    color: #1f2937; /* Black */
}

/* Highlighted Cards (Winning Combination) */
.poker-card.highlighted {
    border-color: #fbbf24;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
    animation: glow 1.5s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
    }
    50% {
        box-shadow: 0 0 30px rgba(251, 191, 36, 0.9);
    }
}

/* Open Cards Button */
#open-cards-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 18px 40px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    margin: 30px auto;
    display: block;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#open-cards-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

#open-cards-btn:active {
    transform: translateY(0);
}

/* Disabled state - still clickable to open modal */
#open-cards-btn:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    cursor: pointer; /* Still clickable to open registration */
    opacity: 0.7;
    box-shadow: 0 4px 15px rgba(107, 114, 128, 0.3);
}

#open-cards-btn:disabled::after {
    content: ' 🔒';
}

/* Results Display */
#poker-results {
    margin: 30px auto;
    padding: 20px;
    background: #f0f8ff;
    border-radius: 12px;
    max-width: 600px;
    display: none;
}

#poker-results.show {
    display: block;
}

.combination-display {
    font-size: 24px;
    font-weight: bold;
    color: #1e73be;
    margin: 10px 0;
}

.prize-display {
    font-size: 32px;
    font-weight: 800;
    color: #16a34a;
    margin: 15px 0;
}

.coupon-display {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.coupon-code {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 2px;
    margin: 10px 0;
    color: #111;
}

#copy-coupon-btn {
    background: #1e73be;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
}

#copy-coupon-btn:hover {
    background: #1557a0;
}

/* Provably Fair Verification Info */
.provably-fair-info {
    background: #fef3c7;
    border: 2px solid #fbbf24;
    border-radius: 8px;
    padding: 15px;
    margin: 20px auto;
    max-width: 600px;
    font-size: 13px;
}

.verification-data {
    font-family: 'Courier New', monospace;
    background: white;
    padding: 8px;
    border-radius: 4px;
    margin: 8px 0;
    word-break: break-all;
}

/* ============================================================================
   MOBILE OPTIMIZATION FOR POKER GRID
   ============================================================================ */

/* Tablet (768-1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    #poker-card-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 12px;
        width: 95%;
    }
    
    .poker-card.face-down::before {
        top: 3px;
        left: 3px;
        right: 3px;
        bottom: 3px;
    }
    
    .poker-card.face-down::after {
        top: 8px;
        left: 6px;
        right: 6px;
        bottom: 8px;
        background-size: 16px 16px, 16px 16px, 16px 16px, 16px 16px, 14px 14px, 100% 100%;
    }
    
    .poker-card .card-rank {
        font-size: 28px;
    }
    
    .poker-card .card-suit {
        font-size: 24px;
    }
}

/* Mobile Landscape (481-767px) */
@media (min-width: 481px) and (max-width: 767px) {
    #poker-card-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 10px;
        width: 98%;
    }
    
    .poker-card.face-down::before {
        top: 3px;
        left: 3px;
        right: 3px;
        bottom: 3px;
        border-width: 1.5px;
    }
    
    .poker-card.face-down::after {
        top: 7px;
        left: 5px;
        right: 5px;
        bottom: 7px;
        background-size: 14px 14px, 14px 14px, 14px 14px, 14px 14px, 12px 12px, 100% 100%;
    }
    
    .poker-card .card-rank {
        font-size: 24px;
    }
    
    .poker-card .card-suit {
        font-size: 20px;
    }
    
    #open-cards-btn {
        font-size: 18px;
        padding: 15px 35px;
    }
}

/* Mobile Portrait (320-480px) */
@media (max-width: 480px) {
    #poker-card-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 8px;
        width: 98%;
    }
    
    .poker-card {
        border-width: 2px;
    }
    
    .poker-card.face-down::before {
        top: 2px;
        left: 2px;
        right: 2px;
        bottom: 2px;
        border-width: 1px;
    }
    
    .poker-card.face-down::after {
        top: 5px;
        left: 4px;
        right: 4px;
        bottom: 5px;
        background-size: 10px 10px, 10px 10px, 10px 10px, 10px 10px, 8px 8px, 100% 100%;
    }
    
    /* Smaller selected badge on mobile */
    .poker-card.selected::before {
        width: 30px;
        height: 30px;
        font-size: 20px;
        border-width: 2px;
    }
    
    .poker-card.selected {
        border-width: 3px !important;
        transform: translateY(-5px) scale(1.05);
    }
    
    .poker-card .card-rank {
        font-size: 20px;
    }
    
    .poker-card .card-suit {
        font-size: 18px;
    }
    
    #open-cards-btn {
        width: 90%;
        font-size: 16px;
        padding: 14px 20px;
    }
    
    .combination-display {
        font-size: 20px;
    }
    
    .prize-display {
        font-size: 26px;
    }
    
    .coupon-code {
        font-size: 20px;
    }
    
    .seed-hash-display {
        padding: 12px;
    }
    
    .seed-hash-value {
        font-size: 10px;
    }
}

/* Extra Small Mobile (<360px) */
@media (max-width: 360px) {
    #poker-card-grid {
        gap: 6px;
    }
    
    .poker-card.face-down::before {
        top: 2px;
        left: 2px;
        right: 2px;
        bottom: 2px;
        border-width: 1px;
    }
    
    .poker-card.face-down::after {
        top: 4px;
        left: 3px;
        right: 3px;
        bottom: 4px;
        background-size: 8px 8px, 8px 8px, 8px 8px, 8px 8px, 6px 6px, 100% 100%;
    }
    
    .poker-card .card-rank {
        font-size: 18px;
    }
    
    .poker-card .card-suit {
        font-size: 16px;
    }
    
    /* Even smaller selected badge for tiny screens */
    .poker-card.selected::before {
        width: 24px;
        height: 24px;
        font-size: 16px;
        border-width: 2px;
    }
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

/* Card Flip Animation */
@keyframes cardFlip {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(180deg);
    }
}

.poker-card.flipping {
    animation: cardFlip 0.6s ease;
}

/* Win Animation */
@keyframes winPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

#poker-results.show {
    animation: winPulse 0.8s ease;
}

/* Loading shimmer animation for cards while waiting for server */
@keyframes cardLoadingShimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.poker-card.card-loading {
    background: linear-gradient(
        90deg,
        #1a5c1a 0%,
        #2d8a2d 25%,
        #4CAF50 50%,
        #2d8a2d 75%,
        #1a5c1a 100%
    );
    background-size: 200% 100%;
    animation: cardLoadingShimmer 1s ease-in-out infinite;
    border-color: #4CAF50 !important;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.6);
}

/* TEST MODE STYLES */
.poker-card.test-mode-card {
    cursor: pointer !important;
    transition: transform 0.2s, box-shadow 0.2s;
}

.poker-card.test-mode-card:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.poker-card.test-mode-card.selected {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px #28a745, 0 8px 25px rgba(40, 167, 69, 0.5);
    z-index: 10;
}

.poker-card.test-mode-card.selected::after {
    content: "✓";
    position: absolute;
    top: 5px;
    right: 5px;
    background: #28a745;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}
