/* Файл: dotascore/static/css/style_table_base.css */
/* Общие стили для всех режимов таблицы лидеров */

/* === ГЛОБАЛЬНЫЙ ФИКС: ПРЕДОТВРАЩЕНИЕ ГОРИЗОНТАЛЬНОГО СКРОЛЛА ВО ВРЕМЯ АНИМАЦИИ === */
html, body {
    /* КРИТИЧНО: Скрывает переполнение, вызванное одновременным отображением двух слайдов */
    overflow-x: hidden;
}

/* === ЗАГОЛОВОК === */
h1 {
    text-align: center;
    color: #f0f8ff; 
    margin-bottom: 30px;
    text-transform: none; 
    letter-spacing: 1px; 
    font-family: 'Roboto', sans-serif;
    font-size: 2.5em; 
    font-weight: 300; 
    text-shadow: 0 0 4px rgba(0, 255, 255, 0.5); 
    position: relative;
    z-index: 2;
}

/* === ОБЩИЕ СТИЛИ СТРОК ТАБЛИЦЫ === */
.leaderboard { 
    list-style: none;
    padding: 0;
    margin: 0;
}

#leaderboard-list {
    margin-left: auto; 
    margin-right: auto;
    padding: 0;
    list-style: none; 
}

#leaderboard-list li { 
    display: flex;
    justify-content: space-between;
    align-items: center; 
    padding: 15px 20px;
    border-bottom: 1px solid #333;
    transition: background-color 0.3s ease;
    border-radius: 5px;
}

#leaderboard-list li:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#leaderboard-list li:last-child {
    border-bottom: none;
}

/* --- СТИЛИ ДЛЯ ЗАГРУЗКИ (SKELETON PLACEHOLDERS) --- */
.loading-placeholder {
    background-color: #222; 
    border-radius: 5px;
    padding: 15px 20px;
    margin-bottom: 10px;
    height: 20px; 
    border-bottom: none !important;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}



/* === СТИЛИ АДАПТИВНОГО ТЕКСТА (РАЗДЕЛЕНИЕ) === */
.mobile-text {
    display: none;
}

/* === БАЗОВЫЕ СТИЛИ КОЛОНОК (ДЛЯ ПК) === */
.rank { 
    flex-basis: 5%;
    text-align: left; 
    font-weight: bold; 
    color: #b3b3b3; 
}

.nickname { 
    flex-basis: 45%;
    text-align: center; 
    color: #ffffff; 
}

/* ========================================================= */
/* --- СТИЛИ ПАГИНАЦИИ (Общие: для ПК) --- */
/* ========================================================= */
#pagination-controls {
    text-align: center; 
    margin: 20px 0 15px;    
    padding: 10px;
    border-top: 1px solid #333; 
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: center;
    align-items: center;
}

#page-info-pc, #page-info-mobile {
    font-weight: bold;
    color: #f0f0f0; 
    margin: 0 15px; 
    font-size: 1.1em;
}

/* БАЗОВЫЕ СТИЛИ КНОПОК ДЛЯ ПК */
#pagination-controls button {
    background-color: #555; 
    color: white;           
    text-shadow: none;
    border: none;
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s, opacity 0.3s;
    font-size: 1em;
    font-weight: 700;
    margin: 0 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    text-indent: 0; 
    position: static; 
    overflow: visible;
}

#pagination-controls button:not(:disabled):hover,
#pagination-controls button:not(:disabled):focus { 
    background-color: #777; 
    outline: 3px solid #00FFFF; 
    outline-offset: 2px;
}

#pagination-controls button:disabled {
    background-color: #333; 
    color: #888;           
    cursor: default;       
    opacity: 0.6;          
    box-shadow: none;      
    text-shadow: none; 
}

/* ----------------------------------------------------------------- */
/* Стили для контейнеров медалей (ПК) */
/* ----------------------------------------------------------------- */
.dota-rank-cell {
    display: flex;
    justify-content: center; 
    align-items: center;
    margin-right: 50px;
}

.rank-icon-wrapper {
    position: relative;
    width: 30px;
    height: 30px;
}

.medal-icon {
    width: 30px;
    height: 30px;
    display: block; 
    object-fit: contain;
}

/* ----------------------------------------------------------------- */
/* Стили для позиционирования звезд по полукругу */
/* ----------------------------------------------------------------- */
.star-container {
    position: absolute;
    top: 58%; 
    left: 50%;
    transform: translate(calc(-50% + 5px), -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.star-icon {
    position: absolute;
    width: 5px;
    height: 5px;
    --angle-range: 100deg;
    --center-angle: 270deg;
    --radius: 20px;
    transform: 
        rotate(calc(
            var(--center-angle) - 
            (var(--angle-range) / 2) + 
            (var(--i) - 1) * (var(--angle-range) / (var(--n-stars) - 1))
        ))
        translate(var(--radius));
    transform-origin: 50% 50%;
    top: 50%;
    left: 50%;
    margin-left: -7.5px;
    margin-top: -7.5px;
}

.star-container[data-n-stars="1"] .star-icon {
    transform: rotate(var(--center-angle)) translate(var(--radius));
    left: 50%;
    margin-left: -7px;
    --angle-range: 0deg; 
}

.star-container[data-n-stars="2"] .star-icon {
    --angle-range: 30deg; 
}

.star-container:not([data-n-stars="1"]):not([data-n-stars="2"]) .star-icon {
     --angle-range: 100deg; 
}

.immortal-number {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: bold;
    color: gold; 
    text-shadow: 1px 1px 2px black;
    white-space: nowrap;
}

/* ========================================================= */
/* === АНИМАЦИЯ ДЛЯ ВСЕХ ЭКРАНОВ (ПК И МОБИЛЬНЫЕ) === */
/* ========================================================= */

/* КОНТЕЙНЕР ДЛЯ PUSH-АНИМАЦИИ */
#leaderboard-list {
    position: relative;
    transition: none; /* Отключаем стандартные transition */
}

/* WRAPPER для анимации (будет создан через JS) */
.leaderboard-wrapper {
    position: relative;
    overflow: hidden; /* Скрывает слайды, пока они заезжают/выезжают */
    width: 100%;
    min-height: 50px; 
}

/* СЛАЙДЫ: Базовое состояние для сдвига */
.leaderboard-slide {
    list-style: none;
    padding: 0;
    margin: 0;
    
    /* КРИТИЧНО: Абсолютное позиционирование для анимации движения */
    position: absolute; 
    width: 100%;
    top: 0;
    left: 0;
    
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Активный слайд: возвращается в поток, чтобы определить высоту wrapper-а и встает на место */
.leaderboard-slide.active {
    /* КРИТИЧНО: В потоке, чтобы определить высоту контейнера */
    position: relative; 
    /* КРИТИЧНО: Гарантируем, что он находится на нулевой позиции */
    transform: translateX(0) !important; 
}

/* --- КЛАССЫ АНИМАЦИИ --- */

/* Старая страница уезжает */
.slide-out-left {
    transform: translateX(-100%) !important;
}

.slide-out-right {
    transform: translateX(100%) !important;
}

/* Новая страница приезжает (изначально за экраном) */
.slide-in-left {
    transform: translateX(-100%) !important;
}

.slide-in-right {
    transform: translateX(100%) !important;
}
/* --- СТИЛИ ДЛЯ ЛИДЕРА (РАНГ 1) --- */
#leaderboard-list li.global-leader-rank-1 {
    border: 2px solid #00FFFF;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.6); 
    border-radius: 50px;
    padding: 13px 18px 14px 18px; 
}

#leaderboard-list li.global-leader-rank-1 .rank {
    color: #FFD700;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    font-weight: 900; 
    font-size: 1.1em;
}

#leaderboard-list li.global-leader-rank-1 .nickname {
    color: #00FFFF;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5); 
    font-weight: bold;
}

/* ========================================================= */
/* --- АДАПТИВНОСТЬ: ОБЩИЕ МОБИЛЬНЫЕ СТИЛИ (Ширина <= 600px) --- */
/* ========================================================= */

@media (max-width: 600px) {
    
    /* Увеличенный padding для всех строчек */
    #leaderboard-list li {
        padding: 15px 10px;
    }
    
    /* СТИЛИ ЛИДЕРА ДЛЯ МОБИЛЬНЫХ */
    #leaderboard-list li.global-leader-rank-1 {
        border: 2px solid #00FFFF !important;
        box-shadow: 0 0 15px rgba(0, 255, 255, 0.8) !important; 
        padding: 13px 10px 14px 10px !important; 
    }
    
    /* Переключение текста */
    .pc-text { display: none; }
    .mobile-text { display: inline; }
    
    /* МЕДАЛЬ НА МОБИЛЬНЫХ */
    .dota-rank-cell {
        display: flex;
        justify-content: center;
        align-items: center;
        flex-basis: 25px;
        min-width: 25px;
        max-width: 25px;
        flex-shrink: 0;
        margin: 0 2px;
        order: 3;
    }
    
    .dota-rank-cell .rank-icon-wrapper {
        width: 20px;
        height: 20px;
    }
    
    .dota-rank-cell .medal-icon {
        width: 20px;
        height: 20px;
    }
    
    .dota-rank-cell .star-icon {
        width: 3px;
        height: 3px;
        --radius: 8px; 
    }
    
    .dota-rank-cell .star-container {
        transform: translate(calc(-50% + 6px), -50%); 
    }
    
    .dota-rank-cell .immortal-number {
        font-size: 6px;
        bottom: -2px;
    }
    
    /* БАЗОВЫЕ КОЛОНКИ (rank и nickname) */
    .rank { 
        order: 1;
        flex-basis: 20px;
        min-width: 15px;
        max-width: 20px;
        flex-shrink: 0;
        flex-grow: 0;
        text-align: left;
        padding-right: 2px;
    }
    
    .player-avatar { 
        order: 2;
        flex-basis: 30px;
        min-width: 30px;
        max-width: 30px;
        flex-shrink: 0;
        flex-grow: 0;
        margin: 0 2px;
    }
    
    .nickname { 
        order: 4;
        flex-basis: 0;
        flex-grow: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: left;
        font-size: 0.85em;
        padding-left: 5px;
    }
    
    /* ПАГИНАЦИЯ НА МОБИЛЬНЫХ */
    #pagination-controls {
        display: flex;
        justify-content: space-between; 
        align-items: center;
        flex-direction: row; 
        width: 100%;
        border-top: none; 
        border-bottom: none;
        margin: 5px 0 10px; 
        padding: 5px 0;
    }

    #page-info-pc, #page-info-mobile {
        font-size: 0.6em; 
        margin: 0 3px;     
        flex-grow: 1;      
        text-align: center;
    }
    
    #pagination-controls button {
        background-color: transparent; 
        color: #00FFFF;                
        text-shadow: 0 0 5px rgba(0, 255, 255, 0.8), 0 0 10px rgba(0, 255, 255, 0.5);
        border: none;                  
        font-size: 1.2em; 
        font-weight: bold; 
        padding: 5px 10px; 
        width: auto; 
        min-width: 30px; 
        max-width: 50px; 
        margin: 0 2px; 
        box-shadow: none; 
        display: flex; 
        justify-content: center;
        align-items: center;
        text-indent: -9999px; 
        position: relative; 
        overflow: hidden;
        -webkit-tap-highlight-color: transparent !important;
        /* КРИТИЧНО: Убираем все возможные outline и background */
        outline: none !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
        user-select: none !important;
        touch-action: manipulation;
    }
    
    #prev-button::after,
    #next-button::after {
        content: ""; 
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        text-indent: 0; 
        text-align: center;
        display: flex; 
        align-items: center; 
        justify-content: center;
    }
    
    #prev-button::after {
        content: "⇦"; 
    }
    
    #next-button::after {
        content: "⇨"; 
    }

    #pagination-controls button:hover,
    #pagination-controls button:active:not(:disabled),
    #pagination-controls button:focus:not(:disabled),
    #pagination-controls button:focus-visible:not(:disabled) { 
        background-color: transparent !important;
        color: #c9e6ff !important;
        box-shadow: none !important;
        outline: none !important;
        border: none !important;
    }
    
    #pagination-controls button:disabled {
        background-color: transparent; 
        color: #5d6671;               
        opacity: 1;                   
        cursor: default;
        text-shadow: none;
    }
}