/* event.css — финальная версия */

/* ===== Шрифт Noodle для результатов ===== */
@font-face {
    font-family: Noodle;
    font-style: normal;
    font-weight: 400;
    src: url(noodle.woff2) format("woff2");
}

/* ===== CSS переменные ===== */
:root {
    --primary-color: #f50666;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --gray-color: #6c757d;
    --light-bg: #f8f9fa;
    --stripe-bg: #f9f9f9;
}

/* ===== Общие стили ===== */
body {
    background-color: #fff;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.container-fluid {
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== Блок выбора категории ===== */
.category-select-container {
    background-color: var(--light-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.category-select-container h3 {
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 1.4rem;
}

/* ===== Таблица результатов (публичная) ===== */
.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background: white;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: auto;
}

.results-table th,
.results-table td {
    padding: 3px 2px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
    white-space: nowrap;
    line-height: 1.2;
}

.results-table tbody td {
    height: 28px;
}

.results-table th {
    background-color: var(--light-bg);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.results-table tbody tr:nth-child(even) {
    background-color: var(--stripe-bg);
}

/* Фиксированная ширина колонок (кроме последней) */
.col-rank { width: 50px; min-width: 50px; text-align: center; }
.col-bib { width: 40px; min-width: 40px; text-align: center; }
.col-name { width: 150px; min-width: 130px; text-align: left; }
.col-category { width: 80px; min-width: 70px; text-align: left; }
.col-ag { width: 50px; min-width: 45px; text-align: center; }
.col-gender { width: 60px; min-width: 50px; text-align: center; }
.col-club { width: 140px; min-width: 120px; text-align: left; }
.col-state { width: 120px; min-width: 100px; text-align: left; }
.col-country { width: 60px; min-width: 50px; text-align: center; }
.col-lap { width: 80px; min-width: 80px; text-align: left; }
.col-result { width: 85px; min-width: 85px; text-align: center; }
.col-diff { width: 70px; min-width: 70px; text-align: left; }
.col-points { width: 60px; min-width: 50px; text-align: center; }
.col-avg-pace { width: 80px; min-width: 70px; text-align: left; }
.col-speed { width: 80px; min-width: 70px; text-align: left; }
.col-elev-speed { width: 90px; min-width: 80px; text-align: left; }
.col-cert { width: 50px; min-width: 40px; text-align: center; }
.col-photo { width: 50px; min-width: 40px; text-align: center; }
.col-video { width: 50px; min-width: 40px; text-align: center; }
.col-note { width: 80px; min-width: 70px; text-align: left; }

/* Резиновая последняя колонка */
.results-table th:last-child,
.results-table td:last-child {
    width: auto !important;
    min-width: 85px;
}

/* Стили для времени (главный результат) */
.time-col {
    color: var(--primary-color);
    font-family: Noodle, 'Segoe UI', sans-serif;
    font-size: 1.6em;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
}

/* Время этапа (эстафета / сегменты) */
.stage-time {
    color: #37464e;
    font-family: Noodle, 'Segoe UI', sans-serif;
    font-size: 1.6em;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
}

/* Статусы DNS/DNF/DSQ — фирменный шрифт Noodle для одинаковой высоты со временем */
.status-dnf,
.status-dns,
.status-dsq {
    font-family: Noodle, 'Segoe UI', sans-serif;
    font-size: 1.5em;
    line-height: 1;
    font-style: normal;
    color: var(--gray-color);
    display: inline-block;
    vertical-align: middle;
    letter-spacing: 0.5px;
}

.unfinished-row {
    opacity: 0.85;
    background-color: #fafafa;
}

/* Позиция на круге (маленькая цифра рядом со временем) */
.lap-position {
    font-size: 0.9em;
    color: var(--primary-color);
    margin-left: 3px;
    display: inline-block;
}

/* Иконка внешней ссылки в заголовке события */
.title-link {
    text-decoration: none;
    margin-left: 2px;
    font-size: 1.2em;
    color: #6c757d;
    transition: color 0.2s;
    display: inline-block;
    vertical-align: baseline;
}

.title-link:hover {
    color: var(--primary-color);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    body { padding: 10px; }
    .results-table th,
    .results-table td { padding: 4px 3px; font-size: 11px; }
    .col-name { width: 130px; }
    .col-club { width: 110px; }
    .col-state { width: 90px; }
    .col-lap { width: 65px; }
    .col-result,
    .col-diff,
    .col-points,
    .col-avg-pace,
    .col-speed,
    .col-elev-speed,
    .col-cert,
    .col-photo,
    .col-video,
    .col-note { min-width: 70px; }
    .results-table th:last-child,
    .results-table td:last-child { min-width: 70px; }

    
}



/* ===== Админка – единый стиль таблиц (как в дашборде) ===== */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th,
.admin-table td {
    padding: 6px 4px;          /* такой же отступ, как в results-table на дашборде */
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.admin-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.admin-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;  /* чередование строк – такой же цвет, как в results-table */
}

/* Поля ввода в админке – компактные, как на дашборде */
.admin-table input[type="number"],
.admin-table input[type="text"] {
    width: 100px;
    padding: 4px 6px;
    font-size: 13px;
    text-align: right;
}

.admin-table input[type="checkbox"] {
    transform: scale(1);
    margin: 0;
}

/* Выравнивание текста */
.admin-table .text-left { text-align: left; }
.admin-table .text-center { text-align: center; }
.admin-table .text-right { text-align: right; }

@media (max-width: 768px) {
    .admin-table th,
    .admin-table td {
        padding: 4px 2px;
        font-size: 12px;
    }
    .admin-table input[type="number"],
    .admin-table input[type="text"] {
        width: 70px;
        font-size: 11px;
    }
}

/* ===== Админка – переопределение кнопок Bootstrap ===== */
.btn-primary {
    background-color: #f50666;
    border-color: #f50666;
    color: white;
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: #d40558;
    border-color: #d40558;
    color: white;
}

.btn-secondary {
    background-color: #e9ecef;
    border-color: #dee2e6;
    color: #495057;
}
.btn-secondary:hover,
.btn-secondary:focus {
    background-color: #dee2e6;
    border-color: #ced4da;
    color: #212529;
}

.btn-info {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}
.btn-info:hover,
.btn-info:focus {
    background-color: #5a6268;
    border-color: #545b62;
    color: white;
}

.btn-success {
    background-color: transparent;
    border-color: #f50666;
    color: #f50666;
}
.btn-success:hover,
.btn-success:focus {
    background-color: #f50666;
    border-color: #f50666;
    color: white;
}

.btn-danger {
    background-color: #6c757d;
    border-color: #6c757d;
}
.btn-danger:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

.btn-outline-secondary {
    border-color: #f50666;
    color: #f50666;
}
.btn-outline-secondary:hover {
    background-color: #f50666;
    border-color: #f50666;
    color: white;
}

/* ===== Информационный блок ===== */
.update-info {
    font-size: 13px;
    color: #6c757d;
    padding: 10px 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid #e9ecef;
}

.update-info .fw-bold {
    font-weight: 600;
    color: #495057;
}

/* ===== Подсветка изменённой строки ===== */
.highlighted-row {
    animation: fadeOutHighlight 5s ease-out forwards;
}

@keyframes fadeOutHighlight {
    0% { background-color: #FFEB3B; }
    70% { background-color: #FFEB3B; }
    100% { background-color: transparent; }
}

/* ===== БАННЕРЫ: карусель на публичной странице ===== */
.banner-carousel {
    flex-shrink: 0;
    width: 260px;
    max-width: 100%;
}

.banner-slider {
    position: relative;
    height: 150px;          /* фиксированная высота – баннеры снова появятся */
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.banner-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1.8s ease-in-out;
    visibility: hidden;
    margin: 0;
    padding: 0;
}

.banner-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

.banner-slide a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-decoration: none;
    margin: 0;
    padding: 0;
}

.banner-link img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    margin: 0;
    padding: 0;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .banner-carousel {
        width: 180px;
    }
    .banner-slider {
        height: 120px;
    }
}

/* ===== АДМИНКА: таблица баннеров ===== */
.banner-preview {
    max-width: 120px;
    max-height: 80px;
}

.table-banners {
    width: 100%;
    border-collapse: collapse;
}

.table-banners th,
.table-banners td {
    vertical-align: middle;
    padding: 8px 6px;
}

/* Заголовки по левому краю (кроме исключений) */
.table-banners th {
    text-align: left;
}

/* 1-я колонка (Image): по центру, фиксированная ширина */
.table-banners th:first-child,
.table-banners td:first-child {
    text-align: center;
    width: 100px;
}

/* 2,3,4 колонки (Description, URL, Duration) – по левому краю */
.table-banners th:nth-child(2),
.table-banners td:nth-child(2),
.table-banners th:nth-child(3),
.table-banners td:nth-child(3),
.table-banners th:nth-child(4),
.table-banners td:nth-child(4) {
    text-align: left;
}

/* 5,6,7,8,9 колонки (Active, Sort, Clicks, Actions, Delete) – по центру */
.table-banners th:nth-child(5),
.table-banners td:nth-child(5),
.table-banners th:nth-child(6),
.table-banners td:nth-child(6),
.table-banners th:nth-child(7),
.table-banners td:nth-child(7),
.table-banners th:nth-child(8),
.table-banners td:nth-child(8),
.table-banners th:nth-child(9),
.table-banners td:nth-child(9) {
    text-align: center;
}

/* Поле Description – шире */
.table-banners td:nth-child(2) input {
    text-align: left;
    width: 100%;
    min-width: 250px;
}

/* Остальные поля нормальной ширины */
.table-banners input[type="text"],
.table-banners input[type="url"],
.table-banners input[type="number"] {
    width: auto;
    max-width: 200px;
}

/* Адаптив для админки */
@media (max-width: 768px) {
    .table-banners td:nth-child(2) input {
        min-width: 150px;
    }
    .table-banners input[type="text"],
    .table-banners input[type="url"],
    .table-banners input[type="number"] {
        max-width: 140px;
    }
}

.table-history {
    font-size: 15px;
}

.results-table .col-start {
    width: 90px;
    text-align: center;
}

.highlight-new {
    background-color: #ffff99 !important; /* ярко-жёлтый */
    transition: background-color 0.5s ease;
}