/**
 * Pinap Games Plugin Styles
 * Стили для отображения популярных игр с overlay эффектом
 */

.promo-games {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.promo-games h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
    color: #333;
}

.game-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, 204px);
    gap: 20px;
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
    justify-content: center; /* Центрируем сетку */
}

@media (min-width: 1200px) {
    .game-list {
        grid-template-columns: repeat(5, 204px);
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .game-list {
        grid-template-columns: repeat(3, 204px);
    }
}

@media (max-width: 767px) {
    .game-list {
        grid-template-columns: repeat(2, 204px);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .game-list {
        grid-template-columns: 204px;
        gap: 15px;
    }
}

.game-list li {
    border-radius: 8px;
    overflow: hidden;
    background: #f8f8f8;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 204px; /* Фиксированная ширина */
    margin: 0 auto; /* Центрируем элемент */
}

.game-list li:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* Контейнер изображения с overlay - фиксированный размер 204x301 */
.game-image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    display: block;
    width: 204px;
    height: 301px;
    margin: 0 auto; /* Центрируем контейнер */
}

/* Затемнение при наведении */
.game-image-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.game-list li:hover .game-image-wrapper::before {
    opacity: 1;
}

/* Изображение игры - фиксированный размер 204x301 */
.game-image-wrapper img {
    width: 204px;
    height: 301px;
    display: block;
    transition: transform 0.3s ease;
    object-fit: cover; /* Обрезаем изображение, сохраняя пропорции */
    object-position: center; /* Центрируем изображение */
}

.game-list li:hover .game-image-wrapper img {
    transform: scale(1.08);
}

/* Название игры - всегда внизу */
.game-title {
    display: block;
    padding: 12px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: #333;
    background: #fff;
}

/* Кнопки поверх картинки - ВЕРТИКАЛЬНО */
.game-buttons {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 80%;
    max-width: 120px;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    justify-content: center;
    align-items: center;
}

.game-list li:hover .game-buttons {
    opacity: 1;
}

/* На мобильных устройствах */
@media (max-width: 767px) {
    .game-list li .game-image-wrapper::before {
        opacity: 0;
    }
    
    .game-buttons {
        opacity: 0;
        /* Принудительное центрирование для мобильных */
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 75%;
        max-width: 100px;
        gap: 8px;
        flex-direction: column;
        justify-content: center;
    }
    
    .game-list li:hover .game-image-wrapper::before {
        opacity: 1;
    }
    
    .game-list li:hover .game-buttons {
        opacity: 1;
    }
    
    /* Уменьшаем размер кнопок на мобильных */
    .game-buttons .btn {
        padding: 8px 12px;
        font-size: 11px;
        letter-spacing: 0.3px;
    }
}

/* Стили кнопок */
.game-buttons .btn {
    display: block;
    width: 100%;
    padding: 10px 15px;
    text-align: center;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Кнопка "Играть" */
.btn-play {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-play:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.5);
}

/* Кнопка "Демо" */
.btn-demo {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
}

.btn-demo:hover {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(240, 147, 251, 0.5);
}

/* Кнопка "Больше игр" - такое же оформление как кнопка "Демо" */
.promo-games .btn-secondary,
.promo-games > .btn-secondary,
.promo-games button.btn-secondary {
    display: block;
    width: 200px;
    margin: 30px auto;
    padding: 15px 30px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
    color: #fff !important;
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-align: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3) !important;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.promo-games .btn-secondary:hover,
.promo-games > .btn-secondary:hover,
.promo-games button.btn-secondary:hover {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(240, 147, 251, 0.4) !important;
}

/* Анимация появления карточек */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-list li {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.game-list li:nth-child(1) { animation-delay: 0.05s; }
.game-list li:nth-child(2) { animation-delay: 0.1s; }
.game-list li:nth-child(3) { animation-delay: 0.15s; }
.game-list li:nth-child(4) { animation-delay: 0.2s; }
.game-list li:nth-child(5) { animation-delay: 0.25s; }
.game-list li:nth-child(6) { animation-delay: 0.3s; }
.game-list li:nth-child(7) { animation-delay: 0.35s; }
.game-list li:nth-child(8) { animation-delay: 0.4s; }
.game-list li:nth-child(9) { animation-delay: 0.45s; }
.game-list li:nth-child(10) { animation-delay: 0.5s; }
.game-list li:nth-child(11) { animation-delay: 0.55s; }
.game-list li:nth-child(12) { animation-delay: 0.6s; }

/* Анимация появления кнопок */
@keyframes buttonSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0) scale(1);
    }
}

.game-list li:hover .game-buttons {
    animation: buttonSlideIn 0.4s ease forwards;
}

/* Отключаем анимацию на мобильных для стабильности */
@media (max-width: 767px) {
    .game-list li:hover .game-buttons {
        animation: none;
    }
}

/* Оптимизация производительности */
.game-list li {
    will-change: transform;
}

.game-image-wrapper {
    backface-visibility: hidden;
}

/* Дополнительные улучшения для больших экранов */
@media (min-width: 1200px) {
    .game-buttons {
        max-width: 130px;
    }
    
    .game-buttons .btn {
        padding: 12px 18px;
        font-size: 13px;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .game-buttons {
        width: 70% !important;
        max-width: 90px !important;
        gap: 6px !important;
        flex-direction: column !important;
        justify-content: center !important;
    }
    
    .game-buttons .btn {
        padding: 6px 10px !important;
        font-size: 10px !important;
        letter-spacing: 0.2px !important;
    }
    
    .game-list {
        gap: 10px;
    }
    
    .promo-games > .btn-secondary {
        width: 160px;
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Эффект при клике на кнопку */
.game-buttons .btn:active {
    transform: scale(0.95);
}

.promo-games > .btn-secondary:active {
    transform: translateY(-1px);
}

/* Улучшение доступности */
.game-buttons .btn:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.promo-games > .btn-secondary:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Плавность всех переходов */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}