:root {
    --ot-orange: #ff4b0b;
    --ot-orange-dark: #d93d08;
    --ot-black: #050505;
    --ot-dark: #0b0b0b;
    --ot-dark-2: #111111;
    --ot-dark-3: #181818;
    --ot-white: #ffffff;
    --ot-light: #e8e8e8;
    --ot-gray: #a8a8a8;
    --ot-gray-dark: #6f6f6f;
    --ot-border: rgba(255, 255, 255, 0.12);
    --ot-border-strong: rgba(255, 255, 255, 0.2);
}

@font-face {
    font-family: "Agency FB Cyrillic";
    src: url("/fonts/AGENCYFBCYRILLIC.TTF") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Agency FB";
    src: url("/fonts/AGENCYR.TTF") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Agency FB";
    src: url("/fonts/AGENCYB.TTF") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Futura PT";
    src: url("/fonts/futura-pt-book.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Futura PT";
    src: url("/fonts/futura-pt-demi.ttf") format("truetype");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Futura PT";
    src: url("/fonts/futura-pt-bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}


/* =========================================================
   БАЗОВЫЕ СТИЛИ
   ========================================================= */

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ot-white);
    font-family: "Futura PT", sans-serif;
    font-weight: 400;
    background-color: var(--ot-black);
    background-image: repeating-linear-gradient( 135deg, rgba(255, 255, 255, 0.025) 0, rgba(255, 255, 255, 0.025) 2px, transparent 2px, transparent 7px );
}


/* =========================================================
   ОСНОВНАЯ СТРАНИЦА
   ========================================================= */

.statistics-page {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 30px 60px;
}


/* =========================================================
   ЛОГОТИП / ШАПКА
   ========================================================= */

.statistics-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 38px 20px 35px;
}

.orangetiming-logo {
    display: block;
    width: min(400px, 70vw);
    height: auto;
}


/* =========================================================
   ЗАГОЛОВОК
   ========================================================= */

.statistics-page-title {
    margin: 15px 0 35px;
    color: var(--ot-orange);
    font-family: "Agency FB Cyrillic", "Agency FB", sans-serif;
    font-size: clamp(2.8rem, 5vw, 4.8rem);
    font-weight: 400;
    line-height: 0.95;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.015em;
}


/* =========================================================
   ОПИСАНИЕ СТАТИСТИКИ
   ========================================================= */

.statistics-description h2 {
    margin: 0 0 10px;
    color: var(--ot-orange);
    font-family: "Agency FB Cyrillic", "Agency FB", sans-serif;
    font-size: 2rem;
    font-weight: 400;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

    .statistics-description h2 {
        margin: 0 0 10px;
        color: var(--ot-orange);
        font-size: 1.7rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.01em;
    }

    .statistics-description div {
        color: var(--ot-light);
        font-family: "Futura PT", sans-serif;
        font-size: 1.05rem;
        font-weight: 400;
        line-height: 1.55;
    }


/* =========================================================
   ФИЛЬТРЫ
   ========================================================= */

.statistics-filters {
    margin-bottom: 24px;
    padding: 20px 24px;
    background: rgba(10, 10, 10, 0.94);
    border: 1px solid var(--ot-border);
    border-top: 3px solid var(--ot-orange);
    border-radius: 0;
}


    /* Bootstrap labels */

    .statistics-filters .form-label {
        color: var(--ot-white);
        font-family: "Futura PT", sans-serif;
        font-size: 0.85rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }


    /* Bootstrap select */

    .statistics-filters .form-select {
        font-family: "Futura PT", sans-serif;
        font-size: 1rem;
        font-weight: 400;
    }

        .statistics-filters .form-select:hover {
            border-color: var(--ot-orange);
        }

        .statistics-filters .form-select:focus {
            color: var(--ot-white);
            background-color: var(--ot-dark-2);
            border-color: var(--ot-orange);
            box-shadow: 0 0 0 2px rgba(255, 75, 11, 0.18);
        }


        /*
   У некоторых браузеров option нельзя полностью
   стилизовать, но задаём тёмный фон там, где возможно.
*/

        .statistics-filters .form-select option {
            color: var(--ot-white);
            background-color: var(--ot-dark-2);
        }


/* =========================================================
   ТАБЛИЦА
   ========================================================= */

.statistics-table-wrapper {
    overflow-x: auto;
    background: rgba(5, 5, 5, 0.95);
    border: 1px solid var(--ot-border);
    border-radius: 0;
}

.statistics-table {
    font-family: "Futura PT", sans-serif;
}


    /* Шапка */

    .statistics-table thead th {
        font-family: "Futura PT", sans-serif;
        font-weight: 600;
        letter-spacing: 0.04em;
    }


    /* Ячейки */

    .statistics-table tbody td {
        font-family: "Futura PT", sans-serif;
        font-weight: 400;
    }


    /* Строки */

    .statistics-table tbody tr {
        transition: background-color 0.15s ease, color 0.15s ease;
    }

        .statistics-table tbody tr:hover {
            background-color: rgba(255, 75, 11, 0.07);
        }


        /* Первая строка */

        .statistics-table tbody tr:first-child:not(.details-row) {
            background-color: rgba(255, 75, 11, 0.08);
        }

            .statistics-table tbody tr:first-child:not(.details-row) td {
                color: var(--ot-white);
            }


            /* Первая строка при наведении */

            .statistics-table tbody tr:first-child:not(.details-row):hover {
                background-color: rgba(255, 75, 11, 0.14);
            }


    /* =========================================================
   НОМЕР МЕСТА
   ========================================================= */

    .statistics-table .place-cell {
        width: 70px;
        color: var(--ot-gray);
        text-align: center;
        white-space: nowrap;
        font-weight: 700;
    }

    .statistics-table tbody tr:first-child .place-cell {
        color: var(--ot-orange);
        font-size: 1.05rem;
    }


    /* =========================================================
   ЧИСЛОВЫЕ ЯЧЕЙКИ, ЗНАЧЕНИЯ ПРОЦЕНТОВ / ИНДЕКСОВ
   ========================================================= */

    .statistics-table .number-cell,
    .statistics-table .percent-value,
    .statistics-table .index-value {
        font-variant-numeric: tabular-nums;
    }


    /* =========================================================
   ССЫЛКИ / ИМЯ СПОРТСМЕНА
   ========================================================= */

    .statistics-table .athlete-name {
        color: var(--ot-white);
        font-weight: 700;
    }

    .statistics-table .athlete-region {
        color: var(--ot-gray);
        font-size: 0.9rem;
    }


    /* =========================================================
   РАСКРЫВАЮЩАЯСЯ ДЕТАЛИЗАЦИЯ
   ========================================================= */

    .statistics-table .details-row {
        background-color: rgba(255, 255, 255, 0.025);
    }

        .statistics-table .details-row > td {
            padding: 0;
            border-top: 0;
        }

    .statistics-table tbody tr.expanded-row {
        background-color: rgba(255, 75, 11, 0.13);
    }

.athlete-details {
    padding: 20px 24px;
    border-top: 2px solid var(--ot-orange);
    border-bottom: 1px solid var(--ot-border);
    background-color: rgba(12, 12, 12, 0.98);
}


    /* Имя спортсмена в детализации */

    .athlete-details .fw-semibold {
        color: var(--ot-orange);
        font-size: 1.1rem;
    }


    /* Таблица деталей */

    .athlete-details .table {
        margin-bottom: 0;
        color: var(--ot-light);
        --bs-table-bg: transparent;
        --bs-table-color: var(--ot-light);
        --bs-table-border-color: var(--ot-border);
    }

        .athlete-details .table thead th {
            padding: 10px;
            color: var(--ot-white);
            background-color: var(--ot-dark-3);
            border-bottom: 1px solid var(--ot-orange);
            white-space: nowrap;
            font-size: 0.72rem;
            font-weight: 800;
            text-transform: uppercase;
        }

        .athlete-details .table tbody td {
            padding: 9px 10px;
            color: var(--ot-light);
            background-color: transparent;
            border-color: var(--ot-border);
            white-space: nowrap;
            font-size: 0.82rem;
        }

        .athlete-details .table tbody tr:hover {
            background-color: rgba(255, 75, 11, 0.06);
        }


/* =========================================================
   СООБЩЕНИЯ
   ========================================================= */

#emptyMessage,
#errorMessage {
    margin-top: 20px;
}


    /* Bootstrap alert переопределяем под тему */

    #errorMessage .alert {
        color: #ffffff;
        background-color: rgba(120, 20, 10, 0.35);
        border: 1px solid rgba(255, 75, 11, 0.45);
        border-radius: 0;
    }

    #emptyMessage .alert {
        color: var(--ot-gray);
        background-color: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--ot-border);
        border-radius: 0;
    }


/* =========================================================
   ИНДИКАТОР ЗАГРУЗКИ
   ========================================================= */

#loadingIndicator {
    color: var(--ot-orange);
}

    #loadingIndicator .spinner-border {
        color: var(--ot-orange) !important;
        border-width: 3px;
    }


/* =========================================================
   ОБЩИЕ BOOTSTRAP КЛАССЫ, КОТОРЫЕ ИСПОЛЬЗУЮТСЯ
   ========================================================= */

.text-muted {
    color: var(--ot-gray) !important;
}

.text-center {
    text-align: center;
}


/* =========================================================
   СКРОЛЛБАР
   ========================================================= */

.statistics-table-wrapper::-webkit-scrollbar,
.athlete-details .table-responsive::-webkit-scrollbar {
    height: 8px;
}

.statistics-table-wrapper::-webkit-scrollbar-track,
.athlete-details .table-responsive::-webkit-scrollbar-track {
    background: var(--ot-dark);
}

.statistics-table-wrapper::-webkit-scrollbar-thumb,
.athlete-details .table-responsive::-webkit-scrollbar-thumb {
    background: var(--ot-orange);
}

    .statistics-table-wrapper::-webkit-scrollbar-thumb:hover,
    .athlete-details .table-responsive::-webkit-scrollbar-thumb:hover {
        background: var(--ot-orange-dark);
    }


/* =========================================================
   ФУТЕР
   ========================================================= */

.statistics-footer {
    padding: 35px 20px 20px;
    color: var(--ot-gray);
    text-align: center;
    font-size: 0.85rem;
}

    .statistics-footer a {
        color: var(--ot-orange);
        text-decoration: none;
    }

        .statistics-footer a:hover {
            color: var(--ot-white);
        }


/* =========================================================
   МОБИЛЬНАЯ ВЕРСИЯ
   ========================================================= */

@media (max-width: 992px) {

    .statistics-page {
        padding-left: 20px;
        padding-right: 20px;
    }

    .statistics-header {
        padding-top: 25px;
        padding-bottom: 25px;
    }

    .statistics-description,
    .statistics-filters {
        padding: 16px 18px;
    }

        .statistics-description h2 {
            font-size: 1.4rem;
        }
}


@media (max-width: 768px) {

    .statistics-page {
        padding-left: 12px;
        padding-right: 12px;
        padding-bottom: 40px;
    }

    .statistics-header {
        padding: 20px 10px;
    }

    .orangetiming-logo {
        width: min(320px, 82vw);
    }

    .statistics-page-title {
        margin-bottom: 25px;
        font-size: 2rem;
    }

    .statistics-description {
        padding: 15px;
    }

        .statistics-description h2 {
            font-size: 1.2rem;
        }

        .statistics-description div {
            font-size: 0.9rem;
        }

    .statistics-filters {
        padding: 15px;
    }

    .statistics-table {
        font-size: 0.88rem;
    }

        .statistics-table thead th,
        .statistics-table tbody td {
            padding: 9px 10px;
        }

    .athlete-details {
        padding: 15px;
    }

        .athlete-details .table thead th,
        .athlete-details .table tbody td {
            padding: 8px;
        }
}


/* =========================================================
   МАЛЕНЬКИЕ ЭКРАНЫ
   ========================================================= */

@media (max-width: 480px) {

    .statistics-page {
        padding-left: 8px;
        padding-right: 8px;
    }

    .orangetiming-logo {
        width: 85vw;
    }

    .statistics-page-title {
        font-size: 1.6rem;
    }

    .statistics-description h2 {
        font-size: 1.05rem;
    }

    .statistics-filters .form-select {
        min-height: 42px;
        font-size: 0.9rem;
    }
}

/* =========================================
   Убираем Bootstrap-белые подложки
   ========================================= */

.card,
.bg-white,
.bg-light {
    background-color: var(--ot-dark) !important;
    color: var(--ot-white) !important;
    border-color: var(--ot-border) !important;
}

/* Внутренние блоки страницы статистики */
.statistics-page,
.statistics-container,
.statistics-content,
.statistics-filters,
.statistics-description,
.statistics-table-wrapper {
    background: transparent !important;
}

/* Если фильтры находятся внутри .card */
.statistics-page .card {
    background: transparent !important;
    border: 1px solid var(--ot-border) !important;
    box-shadow: none !important;
}

/* Bootstrap form controls */
.statistics-page .form-select,
.statistics-page .form-control {
    background-color: var(--ot-dark-2) !important;
    color: var(--ot-white) !important;
    border-color: var(--ot-border-strong) !important;
}

/* Текст placeholder / muted */
.statistics-page .text-muted {
    color: var(--ot-gray) !important;
}

.statistics-panel {
    background: var(--ot-dark) !important;
    border: 1px solid var(--ot-border);
    border-top: 2px solid var(--ot-orange);
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 16px;
}

.statistics-panel-body {
    padding: 16px;
}

/* =========================================
   Statistics layout
   ========================================= */

.statistics-filter-panel,
.statistics-selector,
.statistics-result-panel {
    background: rgba(5, 5, 5, 0.82);
    border: 1px solid var(--ot-border);
    border-radius: 0;
    box-shadow: none;
}

.statistics-filter-panel {
    padding: 16px;
    margin-bottom: 28px;
}

.statistics-selector {
    padding: 14px 16px 16px;
    margin-bottom: 16px;
}

.statistics-result-panel {
    padding: 16px;
}

.statistics-filter-panel .form-label,
.statistics-selector .form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--ot-white);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.statistics-selector .form-label {
    margin-bottom: 8px;
}


/* =========================================
   Dark selects
   ========================================= */

.statistics-filter-panel .form-select,
.statistics-selector .form-select {
    background-color: var(--ot-dark-2) !important;
    color: var(--ot-white) !important;
    border: 1px solid var(--ot-border-strong) !important;
    border-radius: 2px;
    box-shadow: none !important;
    color-scheme: dark;
}

    .statistics-filter-panel .form-select:hover,
    .statistics-selector .form-select:hover {
        border-color: var(--ot-orange) !important;
    }

    .statistics-filter-panel .form-select:focus,
    .statistics-selector .form-select:focus {
        background-color: var(--ot-dark-2) !important;
        color: var(--ot-white) !important;
        border-color: var(--ot-orange) !important;
        box-shadow: 0 0 0 1px var(--ot-orange) !important;
    }

    .statistics-filter-panel .form-select option,
    .statistics-selector .form-select option {
        background-color: var(--ot-dark-2);
        color: var(--ot-white);
    }


/* =========================================
   Result header
   ========================================= */

.statistics-result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.statistics-description {
    margin: 0;
}

    .statistics-description h2 {
        margin: 0 0 8px;
        color: var(--ot-orange);
    }

    .statistics-description > div {
        color: var(--ot-gray);
        line-height: 1.6;
    }

#loadingIndicator {
    color: var(--ot-orange) !important;
    flex-shrink: 0;
}


/* =========================================
   Remove Bootstrap card appearance completely
   ========================================= */

.statistics-page .card,
.statistics-filters .card,
.statistics-result-panel.card {
    background: transparent;
    border: 0;
    box-shadow: none;
}


/* =========================================
   Empty / error
   ========================================= */

#emptyMessage {
    color: var(--ot-gray);
}

#errorMessage {
    background: rgba(255, 75, 11, 0.08);
    color: var(--ot-white);
    border: 1px solid var(--ot-orange);
    border-radius: 0;
}

/* =========================================
   Table typography
   ========================================= */

.statistics-table {
    color: #c8c8c8 !important;
}

/* Заголовки колонок */
.statistics-table thead th {
    color: #8f8f8f !important;
    background: var(--ot-dark-2) !important;
    border-color: var(--ot-border-strong) !important;
    font-weight: 600;
}

/* Основной текст */
.statistics-table tbody td {
    color: #c8c8c8 !important;
    border-color: var(--ot-border-strong) !important;
}

    /* Номер места */
    .statistics-table tbody td:first-child {
        color: #b0b0b0 !important;
        font-weight: 600;
    }

/* Наведение */
.statistics-table tbody tr:hover td {
    color: #ffffff !important;
}

/* Ссылки */
.statistics-table a {
    color: #c8c8c8 !important;
}

.statistics-table a:hover {
    color: #ffffff !important;
}

/* Первое место — оранжевый акцент */
.statistics-table tbody tr:first-child td:first-child {
    color: var(--ot-orange) !important;
    font-weight: 700;
}

.statistics-page-title {
    font-weight: 700 !important;
}

/* =========================================
   Authentication page
   ========================================= */

.auth-page {
    min-height: calc(100vh - 40px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-box {
    width: 100%;
    max-width: 420px;
    padding: 42px;
    background: rgba(5, 5, 5, 0.9);
    border: 1px solid var(--ot-border);
    border-top: 2px solid var(--ot-orange);
}

.auth-logo {
    text-align: center;
    margin-bottom: 35px;
}

    .auth-logo img {
        width: 210px;
        max-width: 80%;
        height: auto;
    }

.auth-box h1 {
    margin: 0 0 10px;
    color: var(--ot-orange);
    font-family: "Agency FB Cyrillic", "Agency FB", sans-serif;
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 0.95;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.auth-subtitle {
    margin: 0 0 28px;
    color: var(--ot-gray);
    text-align: center;
}

.auth-input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    background: var(--ot-dark-2);
    color: var(--ot-white);
    border: 1px solid var(--ot-border-strong);
    border-radius: 2px;
    outline: none;
    font-family: "Futura PT", sans-serif;
    font-size: 1rem;
}

    .auth-input::placeholder {
        color: var(--ot-gray-dark);
    }

    .auth-input:focus {
        border-color: var(--ot-orange);
        box-shadow: 0 0 0 1px var(--ot-orange);
    }

.auth-button {
    width: 100%;
    height: 48px;
    margin-top: 18px;
    border: 1px solid var(--ot-orange);
    border-radius: 2px;
    background: var(--ot-orange);
    color: #ffffff;
    font-family: "Futura PT", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

    .auth-button:hover {
        background: var(--ot-orange-dark);
        border-color: var(--ot-orange-dark);
    }

.auth-error {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid var(--ot-orange);
    background: rgba(255, 75, 11, 0.08);
    color: var(--ot-orange);
    font-size: 0.95rem;
}

@media (max-width: 576px) {
    .auth-box {
        padding: 30px 22px;
    }

        .auth-box h1 {
            font-size: 2rem;
        }
}

.statistics-header {
    position: relative;
}

.logout-form {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
}

.logout-button {
    padding: 7px 14px;
    background: transparent;
    border: 1px solid var(--ot-border-strong);
    border-radius: 2px;
    color: var(--ot-gray);
    font-family: "Futura PT", sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

    .logout-button:hover {
        color: var(--ot-orange);
        border-color: var(--ot-orange);
    }

@media (max-width: 576px) {
    .logout-form {
        position: static;
        transform: none;
        margin-top: 15px;
        text-align: center;
    }
}