/* ============================================
   HOMEPAGE TOP TOURNAMENTS
   Блок топовых турниров главной страницы
   Version: 3.0.0
   Description: Сетка 4 колонки → 2 колонки, независимые карточки турниров
   Dependencies: theme-vars.css, content-blocks.css
   ============================================ */

/* =============================================================
   1. КОНТЕЙНЕР БЛОКА
   ============================================================= */

.homepage-top-tournaments {
    padding: 24px;
}

.homepage-top-tournaments__inner {
    display: flex;
    flex-direction: column;
/*    gap: var(--spacing-lg);*/
}

/* =============================================================
   2. ЗАГОЛОВОК СЕКЦИИ
   ============================================================= */

.homepage-top-tournaments__heading {
    font-family: var(--font-headings);
    font-size: var(--h2-size);
    font-weight: var(--font-bold);
    line-height: var(--h2-line-height);
    color: var(--text-primary);
    text-transform: uppercase;
    border-bottom: 3px solid var(--info);
    padding-bottom: var(--spacing-sm);
    margin: 0 !important;
    text-align: center;
}

/* =============================================================
   3. КОНТЕЙНЕР ФИЛЬТРОВ
   ============================================================= */

.tournament-filters {
    padding: var(--spacing-sm) 0;
    margin-bottom: 0;
}

/* =============================================================
   4. СЕТКА ТУРНИРОВ (4 колонки → 2 колонки)
   ============================================================= */

.homepage-top-tournaments__list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-md, 16px);
    align-items: stretch;
    padding-bottom: 14px;
}

.homepage-top-tournaments__item {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Плавное скрытие при фильтрации */
.homepage-top-tournaments__item[hidden] {
    display: none;
}

/* Растягиваем карточку на всю высоту ячейки */
.homepage-top-tournaments__item .tournament-homepage-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* =============================================================
   5. КАРТОЧКА ТУРНИРА (tournament-homepage-card)
   ============================================================= */

.tournament-homepage-card {
    --thc-bg:         #1e1e2e;
    --thc-bg-hover:   #252538;
    --thc-border:     rgba(255, 255, 255, 0.08);
    --thc-border-hover: rgba(255, 255, 255, 0.14);
    --thc-text:       #b0b0c8;
    --thc-title:      #ffffff;
    --thc-radius:     var(--radius-lg, 12px);
    --thc-shadow:     0 4px 12px rgba(0, 0, 0, 0.15);
    --thc-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.25);
    --thc-transition: all 0.3s ease;

    display:        flex;
    flex-direction: column;
    background:     var(--thc-bg);
    border:         1px solid var(--thc-border);
    border-radius:  var(--thc-radius);
    overflow:       hidden;
    transition:     var(--thc-transition);
    box-shadow:     var(--thc-shadow);
    animation:      tournamentHomepageFadeInUp 0.4s ease forwards;
}

.tournament-homepage-card:hover {
    background:   var(--thc-bg-hover);
    border-color: var(--thc-border-hover);
    transform:    translateY(-4px);
    box-shadow:   var(--thc-shadow-hover);
}

@keyframes tournamentHomepageFadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =============================================================
   6. БАННЕР
   ============================================================= */

.tournament-homepage-card__banner {
    position:    relative;
    width:       100%;
    height:      170px;
    background:  linear-gradient(135deg, #1e1e2e 0%, #2a2a3d 100%);
    overflow:    hidden;
    flex-shrink: 0;
}

.tournament-homepage-card__img {
    width:      100%;
    height:     100%;
    object-fit: cover;
    display:    block;
    transition: transform 0.3s ease;
}

.tournament-homepage-card:hover .tournament-homepage-card__img {
    transform: scale(1.05);
}

.tournament-homepage-card__img-placeholder {
    width:           100%;
    height:          100%;
    background:      linear-gradient(135deg, #1e1e2e 0%, #2a2a3d 50%, #1e1e2e 100%);
    background-size: 200% 200%;
    animation:       shimmerThc 2s infinite;
}

@keyframes shimmerThc {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* =============================================================
   7. БЕЙДЖИ ТИПОВ ТУРНИРОВ
   ============================================================= */

.tournament-homepage-card__badge {
    position:       absolute;
    top:            10px;
    left:           10px;
    padding:        5px 10px;
    font-size:      10px;
    font-weight:    700;
    text-transform: uppercase;
    border-radius:  18px;
    letter-spacing: 0.5px;
    z-index:        2;
    box-shadow:     0 2px 8px rgba(0, 0, 0, 0.4);
    color:          #ffffff;
    background:     #6b7280;
    line-height:    1.3;
    white-space:    nowrap;
    max-width:      calc(100% - 20px);
    overflow:       hidden;
    text-overflow:  ellipsis;
}

/* Цвета бейджей */
.tournament-homepage-card__badge--casino,
.tournament-homepage-card__badge--kazino      { background: #e53e3e; }
.tournament-homepage-card__badge--sport,
.tournament-homepage-card__badge--sports,
.tournament-homepage-card__badge--betting     { background: #10b981; }
.tournament-homepage-card__badge--poker,
.tournament-homepage-card__badge--poker-room  { background: #3b82f6; }
.tournament-homepage-card__badge--live,
.tournament-homepage-card__badge--live-casino { background: #8b5cf6; }
.tournament-homepage-card__badge--slots,
.tournament-homepage-card__badge--slot        { background: #f59e0b; }
.tournament-homepage-card__badge--esport,
.tournament-homepage-card__badge--cybersport  { background: #06b6d4; }
.tournament-homepage-card__badge--lottery,
.tournament-homepage-card__badge--lotto       { background: #ec4899; }

/* =============================================================
   8. ТЕЛО КАРТОЧКИ
   ============================================================= */

.tournament-homepage-card__body {
    padding:        15px 15px 0 15px;
    display:        flex;
    flex-direction: column;
    align-items:    center;
    text-align:     center;
    flex-grow:      1;
}

/* Название — забирает свободное место, выталкивает блоки вниз */
.tournament-homepage-card__title {
    font-size:     16px;
    font-weight:   700;
    color:         var(--thc-title);
    margin-bottom: 12px;
    line-height:   1.3;
    word-wrap:     break-word;
    width:         100%;
    flex-grow:     1;
}

/* =============================================================
   9. ПРИЗОВОЙ ФОНД
   ============================================================= */

.tournament-homepage-card__prize {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    margin-bottom:   14px;
    width:           100%;
    min-height:      64px;
}

.tournament-homepage-card__prize-label {
    font-size:      11px;
    color:          var(--thc-text);
    margin-bottom:  4px;
    letter-spacing: 0.3px;
    font-weight:    500;
    text-transform: uppercase;
}

.tournament-homepage-card__prize-value {
    font-size:   26px;
    font-weight: 800;
    color:       var(--thc-title);
    line-height: 1.2;
}

/* =============================================================
   10. ЛОГОТИП КАЗИНО
   ============================================================= */

.tournament-homepage-card__casino-logo {
    height:          40px;
    min-height:      40px;
    display:         flex;
    align-items:     center;
    justify-content: center;
    margin-bottom:   14px;
    padding:         0 8px;
    width:           100%;
}

.tournament-homepage-card__casino-logo img {
    max-height: 100%;
    max-width:  110px;
    object-fit: contain;
    filter:     drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* =============================================================
   11. СТАТУС И ТАЙМЕР (переиспользуем JS-классы)
   ============================================================= */

.tournament-homepage-card__status {
    width:           100%;
    padding:         8px 5px;
    border-top:      1px solid var(--thc-border);
    display:         flex;
    flex-direction:  column;
    justify-content: center;
    align-items:     center;
    height:          74px;
}

.tournament-homepage-card__status-label {
    font-size:      11px;
    color:          var(--thc-text);
    margin-bottom:  6px;
    font-weight:    500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tournament-homepage-card__status-value {
    font-size:   20px;
    font-weight: 700;
    color:       var(--thc-title);
    line-height: 1.2;
}

.tournament-homepage-card__status-value--finished {
    font-size:   14px;
    color:       var(--thc-text);
    font-weight: 500;
}

.tournament-homepage-card__status-value--unknown {
    font-size:   13px;
    color:       var(--thc-text);
    font-style:  italic;
    font-weight: 400;
}

/* Таймер — переиспользуем классы из tournament-card.css для JS-совместимости */
.tournament-homepage-card__timer {
    display:         flex;
    justify-content: center;
    align-items:     flex-start;
    gap:             3px;
}

.tournament-homepage-card .timer-block {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    min-width:      32px;
}

.tournament-homepage-card .timer-val {
    font-size:     20px;
    font-weight:   700;
    color:         var(--thc-title);
    line-height:   1;
    margin-bottom: 2px;
    font-family:   var(--font-primary);
}

.tournament-homepage-card .timer-lbl {
    font-size:      8px;
    color:          var(--thc-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight:    600;
}

.tournament-homepage-card .timer-sep {
    font-size:   18px;
    font-weight: 700;
    color:       rgba(255, 255, 255, 0.3);
    line-height: 1;
    margin-top:  1px;
    font-family: 'Courier New', monospace;
}

/* =============================================================
   12. КНОПКИ
   ============================================================= */

.tournament-homepage-card__footer {
    display:        flex;
    flex-direction: column;
    gap:            8px;
    padding:        12px 15px 15px;
    flex-shrink:    0;
}

.tournament-homepage-card__btn-main,
.tournament-homepage-card__btn-all {
    width:           100%;
    text-align:      center;
    justify-content: center;
}

/* =============================================================
   13. ЗАГЛУШКА «НЕТ ТУРНИРОВ»
   ============================================================= */

.homepage-top-tournaments__empty {
    padding:      var(--spacing-xl) var(--spacing-lg);
    text-align:   center;
    background:   var(--bg-secondary, rgba(255, 255, 255, 0.04));
    border:       1px dashed var(--border-color);
    border-radius: var(--radius-md);
    color:        var(--text-secondary);
    font-size:    var(--font-base);
    line-height:  var(--line-height-relaxed);
}

/* =============================================================
   14. КНОПКИ БЛОКА
   ============================================================= */

.homepage-top-tournaments__actions {
    display:         flex;
    gap:             var(--spacing-md);
    flex-wrap:       wrap;
    justify-content: flex-start;
}

/* =============================================================
   15. АДАПТИВНОСТЬ: 4 → 2 колонки (без промежуточных 3-х)
   ============================================================= */

/* Планшеты — переход к 2 колонкам */
@media (max-width: 1023px) {
    .homepage-top-tournaments__list {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .homepage-top-tournaments__heading {
        font-size: var(--h2-size-tablet, var(--h2-size));
    }

    .homepage-top-tournaments__actions {
        flex-direction: column;
    }

    .homepage-top-tournaments__actions .gt-button {
        width:           100%;
        justify-content: center;
    }

    .tournament-homepage-card__prize-value { font-size: 22px; }
}

/* Мобильные — остаются 2 колонки */
@media (max-width: 767px) {
    .homepage-top-tournaments__list {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .homepage-top-tournaments__heading {
        font-size: var(--h2-size-mobile, var(--h2-size));
    }

    .homepage-top-tournaments__inner {
/*        gap: var(--spacing-md);*/
    }

    .tournament-homepage-card__banner      { height: 140px; }
    .tournament-homepage-card__title       { font-size: 14px; }
    .tournament-homepage-card__prize-value { font-size: 20px; }
    .tournament-homepage-card__prize {
        min-height: auto; 
        margin-bottom: 5px;
    }
    .tournament-homepage-card__status      { height: auto; min-height: 60px; }

    .tournament-homepage-card__body {
        padding: 12px 12px 0 12px; 
    }
    .tournament-homepage-card__footer      { padding: 8px 12px 12px; gap: 6px; }

    .tournament-homepage-card .timer-val   { font-size: 16px; }
}

/* Маленькие мобильные — 1 колонка */
@media (max-width: 480px) {
    .homepage-top-tournaments__list {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .tournament-homepage-card__banner      { height: 120px; }
    .tournament-homepage-card__title {
        font-size: 13px;
        margin-bottom: 5px;
    }
    .tournament-homepage-card__prize-value {
/*        font-size: 18px;*/
        font-size: 26px;
    }
    .tournament-homepage-card__prize-label { font-size: 10px; }

    .tournament-homepage-card__casino-logo {
        height:     32px;
        min-height: 32px;
    }

    .tournament-homepage-card__casino-logo img {
        max-width: 80px;
    }

    .tournament-homepage-card .timer-val   { font-size: 14px; }
    .tournament-homepage-card .timer-lbl   { font-size: 7px; }
}
