﻿/* ============================================
   СТРАНИЦА "СТАТИСТИКА"
   ============================================ */

.stats-page {
    background-image: url('../images/Back2.jpeg');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    position: relative;
    padding: clamp(120px, 14vh, 160px) var(--page-padding-x) clamp(40px, 6vw, 80px);
    min-height: 100vh;
}

    .stats-page::before {
        content: '';
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 1;
        pointer-events: none;
    }

.stats-inner {
    position: relative;
    z-index: 2;
    max-width: var(--page-max-width);
    margin: 0 auto;
}

/* ---------- Заголовок и описание ---------- */

.stats-title {
    font-size: clamp(1.8rem, 2.8vw, 2.6rem);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-weight: 700;
    margin: 0 0 15px;
}

.stats-desc {
    font-size: 1rem;
    color: #b8c4d4;
    line-height: 1.65;
    max-width: 900px;
    margin: 0 0 clamp(25px, 3vw, 40px);
}

/* ---------- Поиск ---------- */

.stats-search-wrap {
    position: relative;
    max-width: 400px;
    margin: 0 0 clamp(20px, 2.5vw, 30px);
}

.stats-search-input {
    width: 100%;
    padding: 12px 45px 12px 18px;
    background: rgba(20, 20, 20, 0.85);
    border: 1px solid rgba(93, 173, 226, 0.3);
    border-radius: 30px;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

    .stats-search-input::placeholder {
        color: #777;
    }

    .stats-search-input:focus {
        border-color: #5dade2;
        box-shadow: 0 0 0 3px rgba(93, 173, 226, 0.15);
    }

.stats-search-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #5dade2;
    font-size: 1rem;
    pointer-events: none;
}

/* ---------- Таблица ---------- */

.stats-table-wrap {
    border: 1px solid rgba(93, 173, 226, 0.25);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(13, 27, 58, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Заголовок и строки — одна сетка */
.stats-row {
    display: grid;
    grid-template-columns: 90px 1fr 130px 100px 120px 160px;
    gap: 15px;
    align-items: center;
    padding: 14px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.15s;
}

    .stats-row:last-child {
        border-bottom: none;
    }

    .stats-row:not(.stats-header):hover {
        background: rgba(93, 173, 226, 0.06);
    }

/* Заголовок таблицы */
.stats-header {
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(93, 173, 226, 0.25);
    padding: 14px 25px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #5dade2;
    cursor: default;
}

    .stats-header:hover {
        background: rgba(0, 0, 0, 0.4);
    }

/* ---------- Строка игрока ---------- */

.stats-place {
    font-weight: 700;
    color: #f39c12;
    font-size: 1rem;
}

.stats-nick {
    font-weight: 600;
    color: #fff;
    font-size: 0.98rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-stat {
    color: #b8c4d4;
    font-size: 0.95rem;
}

/* Подсветка топ-3 */
.stats-row.rank-1 .stats-place {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.stats-row.rank-2 .stats-place {
    color: #c0c0c0;
    text-shadow: 0 0 10px rgba(192, 192, 192, 0.4);
}

.stats-row.rank-3 .stats-place {
    color: #cd7f32;
    text-shadow: 0 0 10px rgba(205, 127, 50, 0.4);
}

/* ---------- Подсветка авторизованного игрока ---------- */

.stats-row.stats-me {
    background: linear-gradient( 90deg, rgba(243, 156, 18, 0.15) 0%, rgba(243, 156, 18, 0.05) 50%, rgba(243, 156, 18, 0.15) 100% );
    border-left: 3px solid #f39c12;
    border-bottom: 1px solid rgba(243, 156, 18, 0.3);
    padding-left: 22px;
    position: relative;
}

    .stats-row.stats-me::after {
        content: 'Вы';
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
        padding: 3px 10px;
        background: #f39c12;
        color: #fff;
        font-size: 0.7rem;
        font-weight: 700;
        border-radius: 12px;
        letter-spacing: 1px;
        box-shadow: 0 3px 10px rgba(243, 156, 18, 0.5);
        pointer-events: none;
    }

    .stats-row.stats-me:hover {
        background: linear-gradient( 90deg, rgba(243, 156, 18, 0.2) 0%, rgba(243, 156, 18, 0.1) 50%, rgba(243, 156, 18, 0.2) 100% );
    }

    .stats-row.stats-me .stats-nick,
    .stats-row.stats-me .stats-stat,
    .stats-row.stats-me .stats-place {
        color: #fff;
    }

    .stats-row.stats-me .stats-place {
        color: #f39c12;
    }

    /* Визуальный разделитель, если моя строка не в реальном топе */
    .stats-row.stats-me.stats-me-pinned {
        margin-bottom: 8px;
        box-shadow: 0 4px 20px rgba(243, 156, 18, 0.25);
    }

/* ---------- Пусто ---------- */

.stats-empty {
    padding: 60px 20px;
    text-align: center;
    color: #888;
    font-size: 1.05rem;
    font-style: italic;
}

/* ---------- Адаптив ---------- */

@media (max-width: 1000px) {
    .stats-row {
        grid-template-columns: 70px 1fr 110px 80px 100px 130px;
        gap: 12px;
        padding: 12px 18px;
        font-size: 0.9rem;
    }

    .stats-header {
        font-size: 0.72rem;
        padding: 12px 18px;
    }
}

@media (max-width: 800px) {
    /* На узких экранах — упрощаем, часть колонок переносится */
    .stats-row {
        grid-template-columns: 50px 1fr 70px 70px;
    }

        .stats-row > *:nth-child(5), /* Очки */
        .stats-row > *:nth-child(6) { /* Время в игре */
            display: none;
        }

    .stats-header > *:nth-child(5),
    .stats-header > *:nth-child(6) {
        display: none;
    }

    .stats-row.stats-me::after {
        content: 'ВЫ';
        font-size: 0.65rem;
        padding: 2px 8px;
        right: 12px;
    }
}

@media (max-width: 500px) {
    .stats-row {
        grid-template-columns: 40px 1fr 60px;
        gap: 8px;
        padding: 10px 14px;
        font-size: 0.85rem;
    }

        .stats-row > *:nth-child(4) { /* К/Д */
            display: none;
        }

    .stats-header > *:nth-child(4) {
        display: none;
    }
}
