/**
 * Competition Tickets System V3 - WooCommerce Games Styles
 * Developed by You Can Fly Media
 * https://youcanflymedia.co.uk
 */

/* WooCommerce Games Container */
.cts-v4-woocommerce-games {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.woocommerce-game-card {
    background: white;
    border-radius: var(--cts-border-radius);
    box-shadow: var(--cts-box-shadow);
    overflow: hidden;
    transition: var(--cts-transition);
    border: 2px solid transparent;
}

.woocommerce-game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    border-color: var(--cts-primary);
}

.game-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--cts-primary), var(--cts-primary-dark));
    color: white;
    text-align: center;
}

.game-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.game-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 5px;
}

.game-description {
    font-size: 14px;
    opacity: 0.9;
}

.game-content {
    padding: 20px;
}

.game-features {
    list-style: none;
    padding: 0;
    margin: 15px 0;
}

.game-features li {
    padding: 5px 0;
    color: var(--cts-secondary);
    font-size: 14px;
}

.game-features li:before {
    content: "✓";
    color: var(--cts-success);
    font-weight: bold;
    margin-right: 8px;
}

.game-actions {
    margin-top: 20px;
}

.play-woocommerce-game {
    width: 100%;
    padding: 12px;
    background: var(--cts-primary);
    color: white;
    border: none;
    border-radius: var(--cts-border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--cts-transition);
}

.play-woocommerce-game:hover {
    background: var(--cts-primary-dark);
    transform: translateY(-2px);
}

.play-woocommerce-game:disabled {
    background: var(--cts-secondary);
    cursor: not-allowed;
    transform: none;
}

/* Higher or Lower Game */
.higher-lower-modal .game-container {
    text-align: center;
}

.current-product {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
    padding: 20px;
    background: var(--cts-light);
    border-radius: var(--cts-border-radius);
}

.product-image {
    flex: 0 0 150px;
}

.product-image img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: var(--cts-border-radius);
}

.product-info {
    flex: 1;
    text-align: left;
}

.product-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--cts-dark);
}

.product-description {
    color: var(--cts-secondary);
    margin-bottom: 10px;
}

.product-price {
    font-size: 24px;
    font-weight: bold;
    color: var(--cts-success);
}

.game-question {
    margin: 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--cts-dark);
}

.game-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 20px 0;
}

.higher-lower-btn {
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: var(--cts-border-radius);
    cursor: pointer;
    transition: var(--cts-transition);
}

.higher-lower-btn[data-choice="higher"] {
    background: var(--cts-danger);
    color: white;
}

.higher-lower-btn[data-choice="lower"] {
    background: var(--cts-success);
    color: white;
}

.higher-lower-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--cts-box-shadow);
}

.game-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--cts-light);
    border-radius: var(--cts-border-radius);
}

.game-stats > div {
    font-size: 16px;
    font-weight: 600;
    color: var(--cts-dark);
}

.game-progress {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--cts-light);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: var(--cts-primary);
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-size: 14px;
    color: var(--cts-secondary);
}

/* Deal or No Deal Game */
.deal-or-no-deal-modal .game-container {
    text-align: center;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--cts-light);
    border-radius: var(--cts-border-radius);
}

.player-case, .banker-offer {
    font-size: 16px;
    font-weight: 600;
    color: var(--cts-dark);
}

.case-number {
    color: var(--cts-primary);
    font-size: 20px;
}

.offer-amount {
    color: var(--cts-success);
    font-size: 20px;
}

.cases-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.case {
    aspect-ratio: 1;
    background: var(--cts-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    border-radius: var(--cts-border-radius);
    cursor: pointer;
    transition: var(--cts-transition);
}

.case:hover {
    background: var(--cts-primary-dark);
    transform: scale(1.05);
}

.case.opened {
    background: var(--cts-light);
    color: var(--cts-dark);
    cursor: default;
}

.case-content {
    text-align: center;
}

.case-content img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 5px;
}

.case-value {
    font-size: 12px;
    font-weight: bold;
    color: var(--cts-success);
}

.opened-cases {
    margin-top: 20px;
    text-align: left;
}

.opened-cases h4 {
    margin-bottom: 10px;
    color: var(--cts-dark);
}

.opened-case {
    padding: 5px 0;
    font-size: 14px;
    color: var(--cts-secondary);
    border-bottom: 1px solid var(--cts-light);
}

.opened-case:last-child {
    border-bottom: none;
}

.deal-or-no-deal-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--cts-border-radius);
    cursor: pointer;
    transition: var(--cts-transition);
    margin: 0 10px;
}

.deal-or-no-deal-btn[data-action="deal"] {
    background: var(--cts-success);
    color: white;
}

.deal-or-no-deal-btn[data-action="no-deal"] {
    background: var(--cts-secondary);
    color: white;
}

.deal-or-no-deal-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--cts-box-shadow);
}

/* Price is Right Game */
.price-is-right-modal .game-container {
    text-align: center;
}

.current-product {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
    padding: 20px;
    background: var(--cts-light);
    border-radius: var(--cts-border-radius);
}

.bidding-section {
    margin: 20px 0;
}

.bid-input {
    width: 200px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: var(--cts-border-radius);
    font-size: 16px;
    text-align: center;
    margin-right: 10px;
}

.bid-input:focus {
    border-color: var(--cts-primary);
    outline: none;
}

.price-is-right-bid {
    padding: 12px 24px;
    background: var(--cts-primary);
    color: white;
    border: none;
    border-radius: var(--cts-border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--cts-transition);
}

.price-is-right-bid:hover {
    background: var(--cts-primary-dark);
    transform: translateY(-2px);
}

/* Postal Entry Modal */
.postal-entry-form {
    margin-top: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--cts-dark);
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: var(--cts-border-radius);
    font-size: 14px;
}

.form-group input:focus {
    border-color: var(--cts-primary);
    outline: none;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--cts-secondary);
    font-size: 12px;
}

.postal-instructions {
    background: var(--cts-light);
    padding: 15px;
    border-radius: var(--cts-border-radius);
    margin: 20px 0;
}

.postal-instructions h4 {
    margin-bottom: 10px;
    color: var(--cts-dark);
}

.postal-instructions ol {
    margin: 0;
    padding-left: 20px;
}

.postal-instructions li {
    margin-bottom: 5px;
    color: var(--cts-secondary);
    font-size: 14px;
}

/* Game Result Modal */
.game-result {
    text-align: center;
}

.game-result h4 {
    margin-bottom: 20px;
    color: var(--cts-dark);
}

.final-score {
    font-size: 32px;
    font-weight: bold;
    color: var(--cts-success);
    margin-bottom: 20px;
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.use-ticket-btn, .play-again-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--cts-border-radius);
    cursor: pointer;
    transition: var(--cts-transition);
}

.use-ticket-btn {
    background: var(--cts-primary);
    color: white;
}

.play-again-btn {
    background: var(--cts-secondary);
    color: white;
}

.use-ticket-btn:hover, .play-again-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--cts-box-shadow);
}

/* Responsive Design */
@media (max-width: 768px) {
    .cts-v4-woocommerce-games {
        grid-template-columns: 1fr;
    }
    
    .current-product {
        flex-direction: column;
        text-align: center;
    }
    
    .product-info {
        text-align: center;
    }
    
    .game-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .higher-lower-btn {
        width: 100%;
    }
    
    .cases-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .bidding-section {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .bid-input {
        width: 100%;
        margin-right: 0;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .use-ticket-btn, .play-again-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .cases-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .game-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .deal-or-no-deal-btn {
        width: 100%;
        margin: 5px 0;
    }
}

/* Loading States */
.game-loading {
    text-align: center;
    padding: 40px;
    color: var(--cts-secondary);
}

.game-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--cts-light);
    border-top: 4px solid var(--cts-primary);
    border-radius: 50%;
    animation: cts-spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes cts-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error States */
.game-success {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: var(--cts-border-radius);
    margin: 10px 0;
    text-align: center;
}

.game-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: var(--cts-border-radius);
    margin: 10px 0;
    text-align: center;
}

.game-info {
    background: #d1ecf1;
    color: #0c5460;
    padding: 15px;
    border-radius: var(--cts-border-radius);
    margin: 10px 0;
    text-align: center;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Print Styles */
@media print {
    .woocommerce-game-card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
    
    .play-woocommerce-game,
    .higher-lower-btn,
    .deal-or-no-deal-btn,
    .price-is-right-bid {
        display: none;
    }
}
