/* Базовые настройки таблицы */
.table-adaptive table {
    border: none !important;
    background: transparent !important;
    width: 100% !important;
    border-collapse: collapse !important;
}

/* Превращаем tbody в CSS Grid сетку по 3 карточки в ряд */
#cutter_body, #pigs_body {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
    padding: 15px 5px !important;
}

/* Адаптивность под мобилки: 2 карточки в ряд */
@media (max-width: 576px) {
    #cutter_body, #pigs_body {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
}

/* ==========================================================================
   СТИЛИ ДЛЯ КАРТОЧЕК ИГРОКОВ (Применяются только если есть данные)
   ========================================================================== */

/* tr:has(td:nth-child(2)) гарантирует, что стили применятся ТОЛЬКО к строкам с игроками */
#cutter_body > tr:has(td:nth-child(2)), 
#pigs_body > tr:has(td:nth-child(2)) {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: rgba(22, 26, 43, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.04) !important;
    border-radius: 14px !important;
    padding: 18px 10px 15px 10px !important;
    min-height: 190px !important;
    position: relative !important;
    transition: all 0.25s ease-in-out !important;
}

#cutter_body > tr:has(td:nth-child(2)):hover, 
#pigs_body > tr:has(td:nth-child(2)):hover {
    transform: translateY(-3px) !important;
    background: rgba(22, 26, 43, 0.8) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3) !important;
}

/* Позиция игрока (Место) в верхнем правом углу */
#cutter_body > tr:has(td:nth-child(2)) > td:nth-child(1),
#pigs_body > tr:has(td:nth-child(2)) > td:nth-child(1) {
    position: absolute !important;
    top: 8px !important;
    right: 10px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: #8a90a6 !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 2px 7px !important;
    border-radius: 6px !important;
    border: none !important;
}

/* Аватар */
#cutter_body > tr:has(td:nth-child(2)) > td:nth-child(2),
#pigs_body > tr:has(td:nth-child(2)) > td:nth-child(2) {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    border: none !important;
    padding: 10px 0 0 0 !important;
    width: 100% !important;
}

#cutter_body > tr:has(td:nth-child(2)) > td:nth-child(2) img,
#pigs_body > tr:has(td:nth-child(2)) > td:nth-child(2) img {
    width: 52px !important;
    height: 52px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid rgba(255, 255, 255, 0.08) !important;
}

/* Имя игрока и Группа */
#cutter_body > tr:has(td:nth-child(2)) > td:nth-child(3),
#pigs_body > tr:has(td:nth-child(2)) > td:nth-child(3) {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 4px !important;
    border: none !important;
    padding: 8px 0 !important;
    width: 100% !important;
    text-align: center !important;
}

#cutter_body > tr:has(td:nth-child(2)) > td:nth-child(3) a,
#pigs_body > tr:has(td:nth-child(2)) > td:nth-child(3) a {
    font-weight: 600 !important;
    color: #fff !important;
    font-size: 13px !important;
    max-width: 110px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    text-decoration: none !important;
}

#cutter_body > tr:has(td:nth-child(2)) > td:nth-child(3) span,
#pigs_body > tr:has(td:nth-child(2)) > td:nth-child(3) span {
    font-size: 9px !important;
    padding: 1px 6px !important;
    border-radius: 4px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: #8a90a6 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Количество убийств / смертей */
#cutter_body > tr:has(td:nth-child(2)) > td:nth-child(4),
#pigs_body > tr:has(td:nth-child(2)) > td:nth-child(4) {
    display: block !important;
    border: none !important;
    padding: 4px 12px !important;
    text-align: center !important;
    background: rgba(46, 189, 89, 0.12) !important;
    border: 1px solid rgba(46, 189, 89, 0.2) !important;
    color: #2ebd59 !important;
    border-radius: 20px !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    min-width: 80px !important;
    max-width: 110px !important;
    margin: 5px auto 0 auto !important;
}

/* Скрываем пустую ячейку действий */
#cutter_body > tr:has(td:nth-child(2)) > td:nth-child(5),
#pigs_body > tr:has(td:nth-child(2)) > td:nth-child(5) {
    display: none !important;
}

/* ==========================================================================
   ОФОРМЛЕНИЕ ДЛЯ СИСТЕМНОГО СООБЩЕНИЯ "Нет активных записей"
   ========================================================================== */
#cutter_body > tr:not(:has(td:nth-child(2))),
#pigs_body > tr:not(:has(td:nth-child(2))) {
    grid-column: 1 / -1 !important; /* Растягиваем на всю ширину сетки */
    display: block !important;
    text-align: center !important;
    background: rgba(0, 0, 0, 0.15) !important;
    border: 1px dashed rgba(255, 255, 255, 0.07) !important;
    border-radius: 10px !important;
    padding: 30px 15px !important;
    width: 100% !important;
    min-height: auto !important;
}

#cutter_body > tr:not(:has(td:nth-child(2))) td,
#pigs_body > tr:not(:has(td:nth-child(2))) td {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    color: rgba(255, 255, 255, 0.4) !important;
    font-size: 14px !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
}

/* ==========================================================================
   ЭФФЕКТЫ ДЛЯ ТОП-1, ТОП-2, ТОП-3
   ========================================================================== */

/* ТОП-1 (Золото) */
#cutter_body > tr:has(td:nth-child(2)):nth-child(1),
#pigs_body > tr:has(td:nth-child(2)):nth-child(1) {
    background: linear-gradient(135deg, rgba(230, 160, 60, 0.15) 0%, rgba(22, 26, 43, 0.7) 100%) !important;
    border: 1px solid rgba(230, 160, 60, 0.35) !important;
}
#cutter_body > tr:has(td:nth-child(2)):nth-child(1) > td:nth-child(1),
#pigs_body > tr:has(td:nth-child(2)):nth-child(1) > td:nth-child(1) {
    background: #e6a03c !important;
    color: #121420 !important;
}
#cutter_body > tr:has(td:nth-child(2)):nth-child(1) > td:nth-child(2) img,
#pigs_body > tr:has(td:nth-child(2)):nth-child(1) > td:nth-child(2) img {
    border-color: #e6a03c !important;
    box-shadow: 0 0 10px rgba(230, 160, 60, 0.3);
}

/* ТОП-2 (Серебро) */
#cutter_body > tr:has(td:nth-child(2)):nth-child(2),
#pigs_body > tr:has(td:nth-child(2)):nth-child(2) {
    background: linear-gradient(135deg, rgba(160, 160, 160, 0.15) 0%, rgba(22, 26, 43, 0.7) 100%) !important;
    border: 1px solid rgba(160, 160, 160, 0.35) !important;
}
#cutter_body > tr:has(td:nth-child(2)):nth-child(2) > td:nth-child(1),
#pigs_body > tr:has(td:nth-child(2)):nth-child(2) > td:nth-child(1) {
    background: #a0a0a0 !important;
    color: #121420 !important;
}
#cutter_body > tr:has(td:nth-child(2)):nth-child(2) > td:nth-child(2) img,
#pigs_body > tr:has(td:nth-child(2)):nth-child(2) > td:nth-child(2) img {
    border-color: #a0a0a0 !important;
    box-shadow: 0 0 10px rgba(160, 160, 160, 0.2);
}

/* ТОП-3 (Бронза) */
#cutter_body > tr:has(td:nth-child(2)):nth-child(3),
#pigs_body > tr:has(td:nth-child(2)):nth-child(3) {
    background: linear-gradient(135deg, rgba(176, 110, 60, 0.15) 0%, rgba(22, 26, 43, 0.7) 100%) !important;
    border: 1px solid rgba(176, 110, 60, 0.35) !important;
}
#cutter_body > tr:has(td:nth-child(2)):nth-child(3) > td:nth-child(1),
#pigs_body > tr:has(td:nth-child(2)):nth-child(3) > td:nth-child(1) {
    background: #b06e3c !important;
    color: #121420 !important;
}
#cutter_body > tr:has(td:nth-child(2)):nth-child(3) > td:nth-child(2) img,
#pigs_body > tr:has(td:nth-child(2)):nth-child(3) > td:nth-child(2) img {
    border-color: #b06e3c !important;
    box-shadow: 0 0 10px rgba(176, 110, 60, 0.2);
}

/* ==========================================================================
   ОСТАЛЬНЫЕ ЭЛЕМЕНТЫ (Заголовки, Пагинация, Баннер)
   ========================================================================== */

/* Пагинация */
#cutter_pagination > .pagination,
#pigs_pagination > .pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
}

/* Заголовки блоков */
.block_solution .block_head_solution {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.block_solution .block_head_solution > img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Баннер личной статистики */
[data-place="main"] {
    position: relative;
    height: 180px;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #121420;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-place="main"] > .place {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../../../files/icons/background.png') !important;
    background-size: cover;
    background-position: center;
    z-index: 1;
}

[data-place="main"] > .background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(18, 20, 32, 0.45) !important;
    z-index: 2;
}

[data-place="main"] > .info {
    position: relative;
    z-index: 3;
    text-align: center;
    color: #fff;
    width: 100%;
    padding: 20px;
}

[data-place="main"] > .info h5 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 4px 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

[data-place="main"] > .info h5 b {
    color: #2ebd59;
}

[data-place="main"] > .info > .actions {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Кнопки */
.btn-primary {
    background-color: #2ebd59 !important;
    border: none !important;
    font-size: 12px;
    padding: 6px 14px;
    font-weight: 600;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(46, 189, 89, 0.2);
}

.btn-primary:hover {
    background-color: #249947 !important;
}

/* Мобильная адаптивность для баннера */
@media only screen and (max-width: 768px) {
    [data-place="main"] {
        height: auto;
        padding: 30px 15px;
    }
    [data-place="main"] > .info h5 {
        font-size: 1.1rem;
    }
    [data-place="main"] > .info > .actions {
        flex-direction: column;
        gap: 5px;
    }
}