/**
 * KiloBet Casino Second Domain
 * Game Hover Effects & Interactions
 */

/* ==========================================================================
   CSS Variables for Game Hover Effects
   ========================================================================== */

:root {
    /* Game Card Variables */
    --game-card-bg: #ffffff;
    --game-card-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --game-card-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.15);
    --game-card-shadow-active: 0 4px 16px rgba(0, 0, 0, 0.2);
    
    /* Overlay Variables */
    --overlay-bg: rgba(0, 0, 0, 0.9);
    --overlay-bg-light: rgba(0, 0, 0, 0.7);
    --overlay-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Game Image Variables */
    --image-scale: 1.05;
    --image-scale-active: 1.1;
    --image-transition: transform 0.3s ease, filter 0.3s ease;
    
    /* Button Variables */
    --game-btn-bg-free: transparent;
    --game-btn-border-free: #ffffff;
    --game-btn-color-free: #ffffff;
    --game-btn-bg-real: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
    --game-btn-color-real: #ffffff;
    
    /* Provider Label Variables */
    --provider-bg: rgba(0, 0, 0, 0.8);
    --provider-color: #ffffff;
    --provider-transition: all 0.2s ease;
    
    /* Animation Timings */
    --hover-delay: 0.1s;
    --hover-duration: 0.3s;
    --exit-duration: 0.2s;
}

/* ==========================================================================
   Game Card Base Styles
   ========================================================================== */

.game-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: var(--game-card-bg);
    box-shadow: var(--game-card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    aspect-ratio: 1;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        rgba(66, 133, 244, 0.1) 0%, 
        rgba(52, 168, 83, 0.1) 100%);
    opacity: 0;
    transition: opacity var(--hover-duration) ease;
    z-index: 1;
    pointer-events: none;
}

/* ==========================================================================
   Game Image Styles
   ========================================================================== */

.game-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: var(--image-transition);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Image Loading State */
.game-image[data-loading="true"] {
    opacity: 0.7;
    filter: blur(2px);
}

.game-image[data-loaded="true"] {
    opacity: 1;
    filter: none;
    transition: var(--image-transition), opacity 0.3s ease, filter 0.3s ease;
}

/* ==========================================================================
   Provider Label Styles
   ========================================================================== */

.provider-label {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--provider-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--provider-color);
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 4;
    transition: var(--provider-transition);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Game Hover Popup Styles
   ========================================================================== */

.game-hover-popup {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--overlay-transition);
    z-index: 3;
    padding: 20px;
    text-align: center;
}

.game-hover-popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, 
        rgba(66, 133, 244, 0.1) 0%, 
        rgba(0, 0, 0, 0.3) 70%);
    z-index: -1;
}

/* ==========================================================================
   Game Title Styles
   ========================================================================== */

.game-title {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    transform: translateY(10px);
    transition: transform 0.3s ease 0.1s, opacity 0.3s ease 0.1s;
    opacity: 0;
}

/* ==========================================================================
   Game Buttons Container
   ========================================================================== */

.game-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 200px;
    transform: translateY(15px);
    transition: transform 0.3s ease 0.2s, opacity 0.3s ease 0.2s;
    opacity: 0;
}

/* ==========================================================================
   Game Action Buttons
   ========================================================================== */

.game-play-free,
.game-play-real {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 2px solid;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Free Play Button */
.game-play-free {
    background: var(--game-btn-bg-free);
    border-color: var(--game-btn-border-free);
    color: var(--game-btn-color-free);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

.game-play-free::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.2), 
        transparent);
    transition: left 0.5s ease;
}

.game-play-free:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ffffff;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.2);
}

.game-play-free:hover::before {
    left: 100%;
}

.game-play-free:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

/* Real Money Button */
.game-play-real {
    background: var(--game-btn-bg-real);
    border-color: transparent;
    color: var(--game-btn-color-real);
    box-shadow: 0 4px 16px rgba(66, 133, 244, 0.3);
    position: relative;
    overflow: hidden;
}

.game-play-real::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.2) 0%, 
        transparent 50%, 
        rgba(255, 255, 255, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-play-real:hover {
    background: linear-gradient(135deg, #3367d6 0%, #2e7d32 100%);
    color: #ffffff;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.4);
}

.game-play-real:hover::before {
    opacity: 1;
}

.game-play-real:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

/* ==========================================================================
   Hover State Animations
   ========================================================================== */

.game-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--game-card-shadow-hover);
}

.game-card:hover::before {
    opacity: 1;
}

.game-card:hover .game-image {
    transform: scale(var(--image-scale));
    filter: brightness(0.8) contrast(1.1);
}

.game-card:hover .provider-label {
    background: rgba(66, 133, 244, 0.9);
    color: #ffffff;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4);
}

.game-card:hover .game-hover-popup {
    opacity: 1;
    visibility: visible;
}

.game-card:hover .game-title {
    transform: translateY(0);
    opacity: 1;
}

.game-card:hover .game-buttons {
    transform: translateY(0);
    opacity: 1;
}

/* ==========================================================================
   Active State Animations
   ========================================================================== */

.game-card:active {
    transform: translateY(-4px);
    box-shadow: var(--game-card-shadow-active);
}

.game-card:active .game-image {
    transform: scale(var(--image-scale-active));
}

/* ==========================================================================
   Focus States for Accessibility
   ========================================================================== */

.game-card:focus {
    outline: 3px solid rgba(66, 133, 244, 0.5);
    outline-offset: 2px;
}

.game-play-free:focus,
.game-play-real:focus {
    outline: 2px solid rgba(255, 255, 255, 0.7);
    outline-offset: 2px;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.game-card.loading {
    pointer-events: none;
}

.game-card.loading .game-image {
    opacity: 0.5;
    filter: blur(2px);
}

.game-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid rgba(66, 133, 244, 0.3);
    border-radius: 50%;
    border-top-color: #4285f4;
    animation: game-card-spin 1s ease-in-out infinite;
    z-index: 5;
}

@keyframes game-card-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Error States
   ========================================================================== */

.game-card.error {
    opacity: 0.6;
    cursor: not-allowed;
}

.game-card.error .game-image {
    filter: grayscale(100%) brightness(0.5);
}

.game-card.error:hover {
    transform: none;
    box-shadow: var(--game-card-shadow);
}

.game-card.error .game-hover-popup {
    background: rgba(234, 67, 53, 0.9);
}

.game-card.error .game-title::after {
    content: ' (Unavailable)';
    font-size: 0.8em;
    opacity: 0.8;
}

/* ==========================================================================
   Special Effects
   ========================================================================== */

/* Shimmer Effect for Popular Games */
.game-card.popular::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        transparent 30%, 
        rgba(255, 215, 0, 0.5) 50%, 
        transparent 70%);
    border-radius: 14px;
    z-index: -1;
    opacity: 0;
    animation: shimmer 3s ease-in-out infinite;
}

.game-card.popular:hover::after {
    opacity: 1;
}

@keyframes shimmer {
    0%, 100% {
        opacity: 0;
        transform: translateX(-100%);
    }
    50% {
        opacity: 1;
        transform: translateX(100%);
    }
}

/* New Game Badge */
.game-card.new::before {
    content: 'NEW';
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, #ea4335 0%, #d33b2c 100%);
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 4;
    box-shadow: 0 2px 8px rgba(234, 67, 53, 0.3);
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ==========================================================================
   Touch Device Optimizations
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
    .game-card {
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    
    .game-card:hover {
        transform: none;
        box-shadow: var(--game-card-shadow);
    }
    
    .game-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    .game-hover-popup {
        opacity: 1;
        visibility: visible;
        background: rgba(0, 0, 0, 0.7);
        pointer-events: auto;
    }
    
    .game-title,
    .game-buttons {
        transform: translateY(0);
        opacity: 1;
    }
    
    .game-play-free,
    .game-play-real {
        min-height: 48px; /* Larger touch targets */
        font-size: 1rem;
    }
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
    .game-hover-popup {
        padding: 15px;
    }
    
    .game-title {
        font-size: 1rem;
        margin-bottom: 15px;
    }
    
    .game-buttons {
        gap: 10px;
        max-width: 180px;
    }
    
    .game-play-free,
    .game-play-real {
        padding: 10px 20px;
        font-size: 0.85rem;
        min-height: 42px;
    }
    
    .provider-label {
        top: 8px;
        right: 8px;
        padding: 4px 8px;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .game-card:hover {
        transform: translateY(-4px);
    }
    
    .game-hover-popup {
        padding: 12px;
    }
    
    .game-title {
        font-size: 0.9rem;
        margin-bottom: 12px;
    }
    
    .game-buttons {
        gap: 8px;
        max-width: 160px;
    }
    
    .game-play-free,
    .game-play-real {
        padding: 8px 16px;
        font-size: 0.8rem;
        min-height: 40px;
    }
    
    .provider-label {
        top: 6px;
        right: 6px;
        padding: 3px 6px;
        font-size: 0.65rem;
    }
}

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .game-card,
    .game-image,
    .game-hover-popup,
    .game-title,
    .game-buttons,
    .game-play-free,
    .game-play-real,
    .provider-label {
        transition: none;
        animation: none;
    }
    
    .game-card:hover {
        transform: none;
    }
    
    .game-card:hover .game-image {
        transform: none;
        filter: none;
    }
    
    .game-card.popular::after {
        animation: none;
    }
    
    .game-card.new::before {
        animation: none;
    }
}

@media (prefers-contrast: high) {
    .game-hover-popup {
        background: rgba(0, 0, 0, 0.95);
    }
    
    .game-play-free {
        border-width: 3px;
    }
    
    .game-play-real {
        border: 3px solid #ffffff;
    }
    
    .provider-label {
        border: 2px solid #ffffff;
        background: rgba(0, 0, 0, 0.9);
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .game-hover-popup,
    .game-buttons {
        display: none;
    }
    
    .game-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .game-image {
        filter: none;
        transform: none;
    }
}

/* ==========================================================================
   Fallbacks for Older Browsers
   ========================================================================== */

@supports not (backdrop-filter: blur(10px)) {
    .game-hover-popup {
        background: rgba(0, 0, 0, 0.95);
    }
    
    .provider-label {
        background: rgba(0, 0, 0, 0.9);
    }
}