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

:root {
    --green-color: #98ff98;
    --gold-color: #FFD700;
    --purple-color: #b492dbe8;
    --blue-color: #6bcbf8;
    --white-color: #ffffff;
}
/* === ГЛОБАЛЬНЫЙ ФИКС: ПРЕДОТВРАЩЕНИЕ ГОРИЗОНТАЛЬНОГО СКРОЛЛА ВО ВРЕМЯ АНИМАЦИИ === */
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;
}

/* === ТУЛТИП ДЛЯ ХЕАДЕРОВ === */
/* Курсор help на всех ячейках с тултипом */
.header-cell.has-tooltip {
    cursor: help;
}
 
/* Мобильный tap — открытый тултип */
.header-tooltip-box.tooltip-tap-open {
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateX(-50%) translateY(0) !important;
}

.header-cell.has-tooltip:hover .header-tooltip-box {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Крайняя левая */
.header-rank .header-tooltip-box{
    margin-left: 60px;
    transform: none;
}

.header-avatar .header-tooltip-box {
    margin-left: 20px;
    transform: none;
}

.header-rank:hover .header-tooltip-box,
.header-avatar:hover .header-tooltip-box {
    transform: translateX(0) translateY(5px);
}

.header-rank .header-tooltip-box::after {
    right: auto;
    left: 7px;
    transform: none;
}
.header-avatar .header-tooltip-box::after {
    right: auto;
    left: 45px;
    transform: none;
}

/* Крайняя правая */
.header-rating-change .header-tooltip-box {
    right: auto;
    left: 5px;
    transform: translateX(0) translateY(-5px);
}

.header-rating-change:hover .header-tooltip-box {
    transform: translateX(0) translateY(0);
}

.header-rating-change .header-tooltip-box::after {
    left: auto;
    right: 5px;
    transform: none;
}

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

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

#leaderboard-list li { 
    display: flex;
    justify-content: space-between;
    align-items: center; 
    padding: 13px 0 14px 12px;
    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: 50px;
    border-bottom: none !important;
    animation: pulse 1.5s infinite ease-in-out;
}

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



/* === СТИЛИ АДАПТИВНОГО ТЕКСТА (РАЗДЕЛЕНИЕ) === */
.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: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

/* ========== КНОПКИ "НАЗАД" И "ВПЕРЁД" ========== */
#prev-button,
#next-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 8px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #1e2937, #334155);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

#prev-button:hover:not(:disabled),
#next-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #334155, #475569);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.4);
}

/* ========== ЗАБЛОКИРОВАННЫЕ КНОПКИ ========== */
#prev-button:disabled,
#next-button:disabled {
    background: #333;
    color: #888;
    cursor: default;
    opacity: 0.6;
    box-shadow: none;
    transform: none;
    gap: 10px;
    padding: 5px 8px;
}

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

.rank-icon-wrapper {
    padding-left: 1px;
    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: 1px solid #00FFFF;
    box-shadow: 0 4px 6px rgba(0, 255, 255, 0.3), 
                inset 0 0 10px rgba(0, 255, 255, 0.6);
    text-shadow: 0 0 5px var(--purple-color);
    border-radius: 50px;
    padding: 13px 0 14px 12px;
}

#leaderboard-list li.global-leader-rank-1 .rank {
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 1);
    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;
}

.headers-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-top: 0.5px solid #554a5e;
    border-bottom: 0.5px solid #554a5e;

    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.header-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    position: relative;
}

.header-title {
    display: none;  /* Скрыли золотые заголовки */
}

.header-subtitle {
    font-size: 8px;
    color: #aaa;
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Размеры колонок */
.header-rank {
    flex: 0 0 5%;
    min-width: 10px;
    text-align: left;
}

.header-avatar {
    flex: 0 0 5%;
    min-width: 30px;
    text-align: left;
}

.header-player {
    flex: 0 0 38%;
    max-width: 303px;
    text-align: center;
}

.header-dota-rank {
    flex: 0 0 50px;
    text-align: center;
}

.header-guild-rank {
    flex: 0 0 160px;
    margin-left: 10px;
    text-align: center;
}

.header-score {
    flex: 0 0 55px;
    text-align: center;
    position: relative;
    cursor: help;
}

.header-rating-change {
    flex: 0 0 110px;
    text-align: center;
    cursor: help;
}

/* Красивый тултип */
.header-tooltip-box {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: rgba(0, 0, 0, 0.92);
    color: #e0e0e0;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    max-width: 250px;
    min-width: 150px;
    text-align: center;
    transition: all 0.25s ease;
    z-index: 1000;
    border: 1px solid rgba(194, 113, 248, 0.15);
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    white-space: normal;
}

.header-tooltip-box::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.92);
}

.header-score:hover .header-tooltip-box {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.mode-last_3_months .header-tooltip-box {
    z-index: 99999;
    max-width: 250px;
    min-width: 150px;
    white-space: normal;
    height: auto !important;
    min-height: fit-content;
    overflow: visible;
}




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

@media (max-width: 600px) {
    /* Увеличенный padding для всех строчек */
    #leaderboard-list li {
        padding: 15px 10px;
    }
    
    /* СТИЛИ ЛИДЕРА ДЛЯ МОБИЛЬНЫХ */
    #leaderboard-list li.global-leader-rank-1 {
        padding: 13px 10px 14px 10px 
    }

    /* Переключение текста */
    .pc-text { display: none; }
    .mobile-text { display: inline; }

    /* ========== ШАПКА ТАБЛИЦЫ НА МОБИЛЬНЫХ ========== */
    .headers-row {
        display: flex;
        align-items: center;
        padding: 6px 0;
        gap: 4px;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Переопределяем порядок и размеры колонок в шапке для мобильных */
    .header-rank {
        order: 1;
        flex: 0 0 15px;
        padding-left: 16px;
        min-width: 15px;
        max-width: 15px;
    }
    
    .header-avatar {
        order: 2;
        flex: 0 0 30px;
        min-width: 30px;
        max-width: 30px;
        margin: 0 2px;
        text-align: left;
    }
    
    /* Скрываем заголовок "Аватар" на мобильных для экономии места */
    .header-avatar .header-subtitle {
        font-size: 0;
    }
    
    /* Если нужен короткий текст вместо "Аватар" */
    .header-avatar .header-subtitle::after {
        content: 'ава';
        padding-left: 18px;
        font-size: 7px;
    }
    
    .header-dota-rank {
        order: 3;
        flex: 0 0 25px;
        min-width: 25px;
        max-width: 25px;
        padding-left: 16px;
        text-align: center;
        margin: 0 2px;
    }
    
    .header-dota-rank .header-subtitle {
        font-size: 7px;
    }
    
    .header-player {
        order: 4;
        flex: 1 1 auto;
        min-width: 0;
        text-align: left;
        margin-right: 40px;
        max-width: 100px;
    }
    
    /* Скрываем или укорачиваем заголовки для экономии места */
    .header-guild-rank {
        order: 5;
        flex: 0 0 40px;
        min-width: 40px;
        max-width: 40px;
        text-align: center;
        display: none;
    }
    
    .header-guild-rank .header-subtitle {
        font-size: 9px;
    }
    
    .header-score {
        order: 6;
        flex: 0 0 35px;
        min-width: 35px;
        max-width: 35px;
        text-align: center;
        margin-right: 20px;
    }
    
    .header-score .header-subtitle {
        font-size: 7px;
    }
    
    .header-rating-change {
        order: 7;
        flex: 0 0 40px;
        min-width: 40px;
        max-width: 40px;
        text-align: center;
        margin-right: 7px;
        margin-left: 10px;

    }
    
    .header-rating-change .header-subtitle {
        font-size: 7px;
    }


    
    /* Тултип для мобильных */
    .header-tooltip-box {
        max-width: 150px;
        min-width: 120px;
        font-size: 10px;
        padding: 6px 10px;
        bottom: calc(100% + 8px);
    }

    /* МЕДАЛЬ НА МОБИЛЬНЫХ */
    .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: 8px 10px;
        gap: 4px;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 50px;
        border: 1px solid rgba(255, 255, 255, 0.08);
    }

    #page-info-pc, #page-info-mobile {
        font-size: 0.7em; 
        margin: 0 5px;     
        flex-grow: 1;      
        text-align: center;
        font-weight: bold;
        color: #f0f0f0;
    }

    /* ========== КНОПКИ "НАЗАД" И "ВПЕРЁД" ========== */
    #prev-button,
    #next-button {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 10px 16px;
        font-size: 0.85em;
        font-weight: bold;
        color: #818cf8;
        text-shadow: 0 0 8px rgba(99, 102, 241, 0.8), 0 0 15px rgba(139, 92, 246, 0.5);
        background: rgba(99, 102, 241, 0.08);
        border: 1px solid rgba(99, 102, 241, 0.3);
        border-radius: 50px;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
        position: relative;
        overflow: hidden;
        -webkit-tap-highlight-color: transparent !important;
        outline: none !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
        user-select: none !important;
        touch-action: manipulation;
        text-indent: 0;
        min-height: 42px;
        box-sizing: border-box;
    }

    /* Убираем старые псевдоэлементы */
    #prev-button::after,
    #next-button::after {
        display: none;
    }

    /* ========== НАВЕДЕНИЕ И НАЖАТИЕ ========== */
    #prev-button:hover:not(:disabled),
    #next-button:hover:not(:disabled),
    #prev-button:active:not(:disabled),
    #next-button:active:not(:disabled) {
        background: rgba(99, 102, 241, 0.2) !important;
        color: #c7d2fe !important;
        text-shadow: 0 0 12px rgba(99, 102, 241, 1), 0 0 20px rgba(139, 92, 246, 0.8);
        border-color: rgba(139, 92, 246, 0.6);
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
        transform: scale(1.05);
        outline: none !important;
    }

    #prev-button:active:not(:disabled) {
        transform: scale(0.95);
    }

    #next-button:active:not(:disabled) {
        transform: scale(0.95);
    }

    /* ========== ЗАБЛОКИРОВАННЫЕ КНОПКИ ========== */
    #prev-button:disabled,
    #next-button:disabled {
        background: transparent;
        color: #5d6671;
        text-shadow: none;
        border-color: rgba(255, 255, 255, 0.05);
        box-shadow: none;
        opacity: 0.5;
        cursor: default;
        transform: none;
        padding: 10px 16px;
        min-height: 42px;
        box-sizing: border-box;
    }
}    
