/* Mobile Game Cards & Background Complete Fix */
/* Fixes: Game card styling, DEMO/LOGIN buttons visibility, background quality */

@media (max-width: 768px) {
    /* ===== BACKGROUND IMAGE QUALITY FIX ===== */
    /* Force high quality background rendering on mobile */
    .games__hero__wrapper {
        background-image: url("/woocasino/images/spin-mobile.jpg") !important;
        background-size: cover !important;
        background-position: center top !important;
        background-repeat: no-repeat !important;
        background-attachment: scroll !important;
        padding-bottom: 95vw !important;
        min-height: 450px !important;
        width: 100% !important;
        position: relative !important;
        /* High quality rendering */
        image-rendering: -webkit-optimize-contrast !important;
        image-rendering: crisp-edges !important;
        -webkit-backface-visibility: hidden !important;
        backface-visibility: hidden !important;
        transform: translateZ(0) !important;
    }

    /* Ensure background loads properly on all mobile browsers */
    .games__hero__wrapper::before {
        content: '' !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: inherit !important;
        z-index: -1 !important;
    }

    /* ===== GAME CARDS STYLING FIX ===== */
    /* Fix game items grid layout */
    .games-list__wrap {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        padding: 15px 10px !important;
        margin: 0 !important;
    }

    /* Individual game card styling */
    .game-item,
    .game-item.ng-scope {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        position: relative !important;
        border-radius: 12px !important;
        overflow: hidden !important;
        background: #1e2430 !important;
        box-shadow: 0 4px 10px rgba(0,0,0,0.3) !important;
        max-height: none !important;
        height: auto !important;
    }

    /* Game card inner wrapper */
    .game-item--overflow {
        position: relative !important;
        display: block !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* Game card block container */
    .game-item__block {
        position: relative !important;
        width: 100% !important;
        padding-bottom: 56% !important; /* Maintain 16:9 aspect ratio */
        overflow: hidden !important;
        background: #252630 !important;
        border-radius: 12px 12px 0 0 !important;
    }

    /* Game card image */
    .game-item__img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center top !important;
        border-radius: 12px 12px 0 0 !important;
        transition: transform 0.3s ease !important;
        background: #252630 !important;
    }

    /* Image zoom on tap */
    .game-item:active .game-item__img {
        transform: scale(1.05) !important;
    }

    /* ===== GAME LABELS (Active, Hot, etc.) ===== */
    /* Position labels */
    .game-item__labels {
        position: absolute !important;
        top: 8px !important;
        left: 8px !important;
        z-index: 15 !important;
        display: flex !important;
        gap: 6px !important;
    }

    /* Label styling */
    .game-item__label {
        padding: 4px 10px !important;
        font-size: 10px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        border-radius: 12px !important;
        background: rgba(255,215,0,0.9) !important;
        color: #000 !important;
        box-shadow: 0 2px 5px rgba(0,0,0,0.3) !important;
    }

    .game-item__label--hot {
        background: rgba(255,107,53,0.9) !important;
        color: #fff !important;
    }

    /* Live/Active badge */
    .game-item__label-live {
        position: absolute !important;
        top: 8px !important;
        right: 8px !important;
        z-index: 15 !important;
        padding: 4px 10px !important;
        background: rgba(76,222,128,0.9) !important;
        color: #000 !important;
        font-size: 10px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        border-radius: 12px !important;
        box-shadow: 0 2px 5px rgba(0,0,0,0.3) !important;
    }

    /* ===== DEMO/LOGIN OVERLAY - STAYS VISIBLE WHEN CLICKED ===== */
    /* Make overlay stay visible until explicitly dismissed */
    .game-item__overlay {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(0,0,0,0.85) !important;
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: opacity 0.25s ease, visibility 0.25s ease !important;
        z-index: 20 !important;
        border-radius: 12px 12px 0 0 !important;
        pointer-events: none !important;
    }

    /* Show overlay when card has active class - stays visible */
    .game-item.show-overlay .game-item__overlay {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: all !important;
    }

    /* Ensure overlay is clickable */
    .game-item.show-overlay .game-item__overlay * {
        pointer-events: all !important;
    }

    /* Overlay action buttons container */
    .game-item__actions {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        align-items: center !important;
        justify-content: center !important;
        width: 85% !important;
        max-width: 180px !important;
        padding: 15px !important;
        pointer-events: all !important;
    }

    /* DEMO and LOGIN buttons */
    .game-item__actions .button,
    .game-item__actions a.button {
        width: 100% !important;
        padding: 14px 24px !important;
        font-size: 15px !important;
        font-weight: 700 !important;
        text-align: center !important;
        border-radius: 10px !important;
        text-decoration: none !important;
        transition: all 0.2s ease !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
        border: none !important;
        cursor: pointer !important;
        white-space: nowrap !important;
        min-height: 48px !important; /* Larger touch target */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        pointer-events: all !important;
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation !important;
    }

    /* Primary button (DEMO/PLAY) */
    .game-item__actions .button-primary {
        background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%) !important;
        color: #000 !important;
        font-weight: 800 !important;
        text-shadow: 0 1px 2px rgba(255,255,255,0.3) !important;
    }

    .game-item__actions .button-primary:active {
        transform: scale(0.96) !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
    }

    /* Secondary button (LOGIN) */
    .game-item__actions .button-secondary {
        background: rgba(255,255,255,0.2) !important;
        color: #fff !important;
        border: 2px solid rgba(255,255,255,0.4) !important;
        font-weight: 700 !important;
    }

    .game-item__actions .button-secondary:active {
        transform: scale(0.96) !important;
        background: rgba(255,255,255,0.3) !important;
    }

    /* ===== GAME INFO PANEL ===== */
    /* Game title and provider panel at bottom */
    .game-item__panel {
        position: relative !important;
        padding: 8px 10px !important;
        background: #1e2430 !important;
        border-radius: 0 0 12px 12px !important;
        z-index: 10 !important;
        min-height: auto !important;
    }

    /* Provider name */
    .game-item__panel-provider {
        font-size: 9px !important;
        color: #7a7b91 !important;
        text-transform: uppercase !important;
        margin: 0 0 3px 0 !important;
        font-weight: 600 !important;
        letter-spacing: 0.5px !important;
        line-height: 1.2 !important;
    }

    /* Game title */
    .game-item__panel-title {
        font-size: 12px !important;
        color: #fff !important;
        margin: 0 !important;
        font-weight: 600 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1.3 !important;
    }

    /* ===== BITCOIN ICON ===== */
    .game-item__label--bitcoin {
        position: absolute !important;
        bottom: 8px !important;
        right: 8px !important;
        width: 28px !important;
        height: 28px !important;
        background: rgba(255,215,0,0.9) !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 16px !important;
        color: #000 !important;
        box-shadow: 0 2px 5px rgba(0,0,0,0.3) !important;
    }

    /* ===== GAMES LIST SECTION ===== */
    /* Games list container */
    .games-list {
        padding: 20px 0 !important;
        background: transparent !important;
    }

    /* Games list title */
    .games-list__title-wrp {
        padding: 0 15px 15px !important;
    }

    .games-list__title {
        font-size: 24px !important;
        color: #fff !important;
        font-weight: 700 !important;
        margin: 0 !important;
    }

    /* ===== RESPONSIVE ADJUSTMENTS ===== */
    /* Single column for very small screens */
    @media (max-width: 360px) {
        .games-list__wrap {
            grid-template-columns: 1fr !important;
            gap: 15px !important;
        }
    }

    /* Three columns for larger mobile/tablet */
    @media (min-width: 600px) and (max-width: 768px) {
        .games-list__wrap {
            grid-template-columns: repeat(3, 1fr) !important;
            gap: 15px !important;
        }
    }

    /* ===== TOUCH INTERACTIONS ===== */
    /* Better touch feedback */
    .game-item {
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation !important;
    }

    /* Tap effect on entire card */
    .game-item:active {
        transform: scale(0.98) !important;
    }

    /* ===== LOADING STATE ===== */
    /* Image loading placeholder */
    .game-item__img[loading="true"] {
        background: linear-gradient(90deg, #252630 25%, #2f3140 50%, #252630 75%) !important;
        background-size: 200% 100% !important;
        animation: loading 1.5s ease-in-out infinite !important;
    }

    @keyframes loading {
        0% {
            background-position: 200% 0;
        }
        100% {
            background-position: -200% 0;
        }
    }
}

    /* ===== CLOSE BUTTON FOR OVERLAY ===== */
    /* Add a close X button to dismiss overlay */
    .game-item.show-overlay .game-item__overlay::before {
        content: '✕' !important;
        position: absolute !important;
        top: 10px !important;
        right: 10px !important;
        width: 30px !important;
        height: 30px !important;
        background: rgba(0,0,0,0.6) !important;
        color: #fff !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 18px !important;
        font-weight: bold !important;
        cursor: pointer !important;
        z-index: 30 !important;
        border: 2px solid rgba(255,255,255,0.3) !important;
    }

/* ===== LARGER MOBILE SCREENS (600px+) ===== */
@media (min-width: 600px) and (max-width: 768px) {
    .games__hero__wrapper {
        padding-bottom: 80vw !important;
        min-height: 500px !important;
    }
    
    .game-item__actions .button {
        font-size: 15px !important;
        padding: 13px 22px !important;
    }
}

/* ===== VERY SMALL SCREENS (320px-375px) ===== */
@media (max-width: 375px) {
    .game-item__actions .button {
        font-size: 13px !important;
        padding: 10px 16px !important;
    }

    .game-item__panel {
        padding: 8px 10px !important;
    }

    .game-item__panel-title {
        font-size: 12px !important;
    }
}

