/* race-analysis.css - Стили для страницы Анализ забегов */

/* Основной контейнер */
.race-analysis-container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: var(--background);
    padding: 40px 40px;
}

.race-analysis-header {
    text-align: center;
    margin-bottom: 50px;
}

.race-analysis-header h1 {
    font-size: 36px;
    color: var(--text-dark);
    margin: 20px 0 30px;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.05);
}

.race-analysis-header p {
    font-size: 16px;
    color: var(--text-light);
    line-height: 1.8;
    max-width: 600px;
    margin: 0 auto;
}

/* Кнопка возврата */

.back-button a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background-color: var(--white);
    color: var(--km-primary, #EE2D62);
    font-weight: 600;
    text-decoration: none;
    border: 2px solid var(--km-primary, #EE2D62);
    border-radius: 50px;
    transition: all 0.3s ease;
    font-size: 15px;
    box-shadow: var(--shadow);
}

.back-button a:hover {
    background-color: var(--km-primary, #EE2D62);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(238, 45, 98, 0.3);
}

.back-button a:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(238, 45, 98, 0.2);
}

.back-button svg {
    width: 20px;
    height: 20px;
    transform: scaleX(-1);
}

/* Сетка карточек */
.race-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    padding: 0;
}

/* Карточка забега */
.race-card {
    position: relative;
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    border: none;
}

.race-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 28px rgba(238,45,98,.2);
}

/* Цвета для каждого забега */


.race-card:nth-child(1) .race-card-image {
    background-image: url('/static/images/events/logo1x1/Ночной забег.png');
    background-size: cover;
    background-position: center;
}

.race-card:nth-child(2) .race-card-image {
    background-image: url('/static/images/events/logo1x1/Весна.png');
    background-size: cover;
    background-position: center;
}

.race-card:nth-child(3) .race-card-image {
    background-image: url('/static/images/events/logo1x1/Красочный забег.png');
    background-size: cover;
    background-position: center;
}

.race-card:nth-child(4) .race-card-image {
    background-image: url('/static/images/events/logo1x1/Женская семерка.png');
    background-size: cover;
    background-position: center;
}

.race-card:nth-child(5) .race-card-image {
    background-image: url('/static/images/events/logo1x1/Жара.png');
    background-size: cover;
    background-position: center;
}

.race-card:nth-child(6) .race-card-image {
    background-image: url('/static/images/events/logo1x1/Детский забег.png');
    background-size: cover;
    background-position: center;
}

.race-card:nth-child(7) .race-card-image {
    background-image: url('/static/images/events/logo1x1/Х Трейл.png');
    background-size: cover;
    background-position: center;
}

.race-card:nth-child(8) .race-card-image {
    background-image: url('/static/images/events/logo1x1/Снежная семерка.png');
    background-size: cover;
    background-position: center;
}

.race-card-image {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    object-fit: cover;
    transition: transform .4s ease;
}

.race-card:hover .race-card-image {
    transform: scale(1.04);
}

.race-card-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.35));
    z-index: 1;
    transition: background 0.3s ease;
}

.race-card:hover .race-card-overlay {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.65));
}

.race-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 28px 24px;
    color: var(--white);
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
}

.race-card-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.2;
    letter-spacing: 0.3px;
}

.race-card-description {
    font-size: 13px;
    opacity: 0.95;
    line-height: 1.5;
    font-weight: 500;
}

/* Модальное окно */
.race-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.race-modal.active {
    display: flex;
}

.race-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

.race-modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--white);
    border-radius: 12px;
    padding: 40px;
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1002;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, calc(-50% - 20px));
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.race-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-dark);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.race-modal-close:hover {
    background-color: #f0f0f0;
    color: var(--km-primary, #EE2D62);
}

.race-modal-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 20px 0;
}

.race-modal-body {
    font-size: 16px;
    color: var(--text-light);
    line-height: 1.6;
}

.race-modal-body p {
    margin: 0;
}

/* === НОВЫЕ СТИЛИ ДЛЯ ДЕТАЛЕЙ ЗАБЕГА === */

.race-details {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.race-info,
.race-info-section {
    padding: 0;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--km-primary, #EE2D62);
    margin: 0 0 16px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

/* Информация о забеге */
.race-info-section .info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}

.race-info-section .info-row:last-child {
    border-bottom: none;
}

.race-info-section .info-label {
    font-weight: 600;
    color: var(--text-dark);
    flex: 0 0 auto;
    margin-right: 12px;
}

.race-info-section .info-value {
    color: var(--text-light);
    text-align: right;
    flex: 1;
}

/* Сетка статистики */
.race-stats-section {
    margin: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.stat-item {
    background-color: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid var(--km-primary, #EE2D62);
}

.stat-item:nth-child(2) {
    border-left-color: #059C43;
}

.stat-item:nth-child(3) {
    border-left-color: #85c6e2;
}

.stat-item:nth-child(4) {
    border-left-color: #562872;
}

.stat-label {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
}

/* Лучший результат */
.race-best-section {
    margin: 0;
}

.best-result {
    background: linear-gradient(135deg, #fff5f8 0%, #fffbfc 100%);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--km-primary, #EE2D62);
}

.best-runner-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.best-year {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: 12px;
}

.distance-block + .distance-block {
    border-top: 2px solid #f0f0f0;
    padding-top: 16px;
    margin-top: 8px;
}

.distance-block-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--km-primary, #EE2D62);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--km-primary, #EE2D62);
}

.best-result-metrics {
    display: flex;
    gap: 20px;
}

.best-result-metrics .metric {
    flex: 1;
}

.metric-label {
    display: block;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
    font-weight: 500;
}

.metric-value {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--km-primary, #EE2D62);
}

/* Средние темпы */
.race-pace-section {
    margin: 0;
}

.pace-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.pace-item {
    background-color: #f0f8ff;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    border-top: 3px solid #00BFDF;
}

.pace-item:nth-child(2) {
    background-color: #f8f5ff;
    border-top-color: #562872;
}

.pace-item:nth-child(3) {
    background-color: #fff5f8;
    border-top-color: var(--km-primary, #EE2D62);
}

.pace-label {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
    font-weight: 500;
}

.pace-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    font-family: 'Courier New', monospace;
}

/* График участников по годам */
.race-chart-section {
    margin: 0;
}

.race-chart-container {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    max-height: 400px;
    min-height: 300px;
    position: relative;
}

.race-chart-container canvas {
    max-height: 350px;
}

.chart-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-light);
    font-size: 14px;
}

/* Адаптивный дизайн */
@media (max-width: 768px) {
    .pace-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .best-result-metrics {
        flex-direction: column;
        gap: 12px;
    }
    
    .race-modal-container {
        padding: 20px;
        max-width: 98%;
        max-height: 98vh;
    }
    
    .race-chart-container {
        max-height: 300px;
        min-height: 250px;
    }
}
@media (max-width: 768px) {
    .race-analysis-container {
        padding: 20px 20px;
    }

    .back-button {
        padding: 0 20px;
        margin-bottom: 25px;
    }

    .race-cards-container {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 15px;
    }

    .race-card {
        height: 220px;
    }

    .race-card-title {
        font-size: 16px;
    }

    .race-card-content {
        padding: 18px 16px;
    }

    .race-analysis-header h1 {
        font-size: 28px;
    }

    .race-analysis-header p {
        font-size: 14px;
    }

    .back-button a {
        font-size: 14px;
        padding: 10px 20px;
    }

    .race-modal-container {
        padding: 30px 24px;
        width: 95%;
    }

    .race-modal-title {
        font-size: 24px;
    }

    .race-modal-close {
        width: 28px;
        height: 28px;
        font-size: 24px;
    }

    .race-card-content { display: none; }
}
