/* Стили для новой страницы результатов */

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.header {
    margin-bottom: 30px;
}

.header h1 {
    color: #333;
    margin-bottom: 20px;
}

.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-controls p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

/* Стили для сообщения о том, что нет активных соревнований */
.no-competitions {
    text-align: center;
    padding: 40px 20px;
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    margin: 20px 0;
}

.no-competitions p {
    margin: 10px 0;
    color: #6c757d;
}

.no-competitions p:first-child {
    font-size: 18px;
    font-weight: 600;
    color: #495057;
}

.no-competitions .help-text {
    font-size: 14px;
    color: #6c757d;
    font-style: italic;
}


/* Результаты для каждого соревнования */
.competition-results {
    margin-bottom: 40px;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 25px;
    background-color: #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

/* Стили для заголовков таблицы */
.main-header {
    background-color: #f8f9fa;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    padding: 16px 12px;
    border-bottom: 2px solid #dee2e6;
    font-size: 1.1em;
    color: #495057;
}

.qualification-header {
    background-color: #e3f2fd;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    padding: 16px 12px;
    border-bottom: 2px solid #2196f3;
    font-size: 1.1em;
    color: #1976d2;
}

.tour-header {
    background-color: #f8f9fa;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    padding: 16px 12px;
    border-bottom: 2px solid #dee2e6;
    font-size: 1.1em;
    color: #495057;
}

.sub-header {
    background-color: #f0f8ff;
    font-weight: 500;
    text-align: center;
    vertical-align: middle;
    padding: 12px 8px;
    border-bottom: 1px solid #b3d9ff;
    font-size: 0.95em;
    color: #1565c0;
}

/* Стили для ячеек результатов */
.result-cell {
    font-weight: 500;
    text-align: center;
}

/* Выделение результата квалификации жирным шрифтом */
.result-cell.result-qualification {
    font-weight: 700;
    color: #1f2937;
    font-size: 1.05em;
}

.competition-results:hover {
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

/* Заголовок результатов */
.results-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #007bff;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    margin: -25px -25px 20px -25px;
    padding: 20px 25px 15px 25px;
    border-radius: 12px 12px 0 0;
}

.results-header h2 {
    color: #2c3e50;
    margin: 0 0 8px 0;
    font-size: 1.5em;
    font-weight: 700;
}

.results-header .stage-info {
    color: #6c757d;
    margin: 0;
    font-size: 1em;
    font-weight: 500;
}

/* Контейнер таблицы */
.results-table-container {
    overflow-x: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    background-color: #ffffff;
    max-width: 100%;
}

/* Таблица результатов */
.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

/* Стили для заголовков */
.results-table th {
    background-color: #343a40;
    color: white;
    padding: 8px 6px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #495057;
    vertical-align: middle;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Стили для кликабельных ячеек результатов */
.result-cell {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.result-cell:hover {
    background-color: #e3f2fd !important;
    font-weight: 600;
}

/* Стили для ячеек данных */
.results-table td {
    padding: 6px 4px;
    text-align: center;
    border: 1px solid #dee2e6;
    vertical-align: middle;
}

/* Заголовок категории */
.results-table tr.category-header td {
    background-color: #e9ecef;
    font-weight: 700;
    color: #495057;
    text-align: left;
    padding: 10px 15px;
    border-bottom: 2px solid #adb5bd;
}

/* Строки участников */
.results-table tr.even {
    background-color: #ffffff;
}

.results-table tr.odd {
    background-color: #f8f9fa;
}

.results-table tr:hover {
    background-color: #e3f2fd;
}

/* Стили для колонок */
.results-table td:nth-child(1) { /* Место */
    font-weight: 500;
    color: #333;
    width: 60px;
}

.results-table td:nth-child(2) { /* Номер */
    font-weight: 500;
    color: #333;
    width: 60px;
}

.results-table td:nth-child(3) { /* ФИО */
    text-align: left;
    font-weight: 500;
    min-width: 200px;
}


/* Результаты по этапам */
.results-table td:nth-child(n+4) {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    width: 80px;
}

/* Специальные значения */
.results-table td:contains("NF") {
    color: #dc3545;
    font-weight: 600;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .results-table {
        font-size: 10px;
        min-width: auto;
    }
    
    .results-table th,
    .results-table td {
        padding: 4px 2px;
    }
    
    .results-table td:nth-child(2) { /* Номер */
        width: 50px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .results-table td:nth-child(n+4) { /* Результаты по этапам */
        width: 60px;
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    .results-table {
        font-size: 9px;
    }
    
    .results-table th,
    .results-table td {
        padding: 3px 1px;
    }
    
    .results-table td:nth-child(2) { /* Номер */
        width: 40px;
    }
    
    .results-table td:nth-child(n+4) { /* Результаты по этапам */
        width: 50px;
        font-size: 8px;
    }
}

/* Модальное окно для деталей результата */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: none;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 25px;
}

.attempt-details {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.attempt-details h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 1.1em;
    font-weight: 600;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 5px 0;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-row .label {
    font-weight: 500;
    color: #6c757d;
    min-width: 80px;
}

.detail-row .value {
    font-weight: 600;
    color: #2c3e50;
    font-family: 'Courier New', monospace;
    background-color: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 60px;
    text-align: center;
}

/* Печать */
@media print {
    .header {
        display: none;
    }
    
    .results-table-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .results-table th {
        background-color: #000 !important;
        color: #fff !important;
    }
    
    .modal {
        display: none !important;
    }
}

/* Стили для модального окна ссылки */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 25px;
}

.link-container {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.link-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background-color: #f8f9fa;
}

.link-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.help-text {
    font-size: 13px;
    color: #6c757d;
    margin: 10px 0 0 0;
    font-style: italic;
}

/* Адаптивность для модального окна */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .link-container {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}
