* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ========== ШАПКА ========== */
header {
    background: linear-gradient(135deg, #1a3a5f, #2c5a8a);
    color: white;
    padding: 12px 0;
    text-align: center;
    border-radius: 0 0 15px 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
}

.header-content {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-left: 15px;
}

.athlete-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.athlete-photo i {
    font-size: 2.5rem;
    color: white;
    opacity: 0.9;
}

.athlete-info {
    text-align: center;
    max-width: 400px;
}

.athlete-name {
    font-size: 1.4rem;
    margin-bottom: 6px;
    font-weight: 700;
}

.basic-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
}

.basic-info p {
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: center;
}

/* ========== ФИКСИРОВАННАЯ ШАПКА ========== */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(26, 58, 95, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.back-button span {
    transition: all 0.3s ease;
    display: inline-block;
    max-width: 80px;
}

.athlete-name-header {
    color: white;
    font-weight: 600;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    text-align: center;
    margin: 0 10px;
}

.athlete-name-header.visible {
    opacity: 1;
}

/* ========== СТАТИСТИКА ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card h3 {
    color: #2c5a8a;
    margin-bottom: 12px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-card i {
    font-size: 1.3rem;
}

.stat-value {
    font-size: 1.7rem;
    font-weight: 700;
    color: #1a3a5f;
}

.stat-description {
    color: #666;
    margin-top: 2px;
    font-size: 0.85rem;
}

/* ========== МЕДАЛИ ========== */
.medal-stats {
    margin-top: 15px;
}

.medal-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
}

.medal-icon {
    font-size: 1.8rem;
}

.gold { color: #FFD700; }
.silver { color: #C0C0C0; }
.bronze { color: #CD7F32; }
.wood { color: #8B4513; }
.other { color: #45b7d1; }

.medal-details {
    flex: 1;
}

.medal-count {
    font-size: 1.2rem;
    font-weight: 700;
}

.medal-event {
    font-size: 0.8rem;
    color: #666;
}

/* ========== КЛИКАБЕЛЬНЫЕ МЕДАЛИ ========== */
.medal-stats .medal-item.clickable-medal {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.medal-stats .medal-item.clickable-medal:hover {
    background-color: #f0f4f8 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.medal-stats .medal-item.clickable-medal:hover .medal-icon {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

.medal-stats .medal-item.clickable-medal:hover .medal-count {
    color: #2c5a8a;
}

.medal-stats .medal-item.clickable-medal:hover .medal-event {
    color: #1a3a5f;
}

.medal-stats .medal-item.clickable-medal:hover .icons-group i,
.medal-stats .medal-item.clickable-medal:hover .map-icon i {
    color: #2c5a8a;
}

.medal-stats .medal-item.clickable-medal:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.medal-stats .medal-item.clickable-medal:hover .medal-icon.gold {
    filter: drop-shadow(0 4px 8px rgba(255, 215, 0, 0.5));
}

@media (max-width: 768px) {
    .medal-stats .medal-item.clickable-medal:hover {
        transform: none;
    }
}

/* ========== ЗАГОЛОВКИ СЕКЦИЙ ========== */
.section-title {
    font-size: 1.4rem;
    color: #1a3a5f;
    margin: 5px 0 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #eaeaea;
}

/* ========== ТАБЛИЦА ========== */
.competition-history {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.competition-table {
    width: 100%;
    border-collapse: collapse;
    min-width: auto;
    table-layout: auto;
}

.competition-table th,
.competition-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eaeaea;
    font-size: 0.9rem;
}

.competition-table th {
    background-color: #f8f9fa;
    color: #1a3a5f;
    font-weight: 600;
    position: sticky;
    top: 0;
    cursor: pointer;
    user-select: none;
}

.competition-table th:hover {
    background-color: #e9f5ff;
}

.competition-table th i {
    margin-left: 5px;
    font-size: 0.8rem;
    opacity: 0.7;
}

.competition-table th .full-text {
    display: inline;
}

.competition-table th .short-text {
    display: none;
}

.competition-table tr:hover {
    background-color: #f5f7fa;
}

.place-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    min-width: 24px;
}

.place-1 { background-color: #FFD700; color: #333; }
.place-2 { background-color: #C0C0C0; color: #333; }
.place-3 { background-color: #CD7F32; color: #fff; }
.place-top10 { background-color: #e9f5ff; color: #1a3a5f; }
.place-other { background-color: #f5f5f5; color: #666; }
.place-dnf { background-color: #ffebee; color: #d32f2f; border: 1px dashed #d32f2f;}

.table-container {
    max-height: 600px;
    overflow-y: auto;
}

/* ========== ФИЛЬТРЫ ========== */
.compact-filters {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    border: 1px solid #eaeaea;
}

.filter-icon {
    margin-right: 6px;
    font-size: 14px;
    color: #666;
}

.filter-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.filter-dropdown-btn {
    padding: 10px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #555;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
    justify-content: space-between;
    font-size: 0.9rem;
}

.filter-dropdown-btn:hover {
    border-color: #2c5a8a;
    color: #2c5a8a;
}

.filter-dropdown-btn.has-selection {
    background-color: #e9f5ff;
    border-color: #2c5a8a;
    color: #1a3a5f;
    font-weight: 600;
}

.filter-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    max-height: min(300px, 50vh);
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    margin-top: 4px;
    padding: 8px;
}

.filter-dropdown-content.show {
    display: block;
}

.filter-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 4px;
    font-size: 0.9rem;
}

.filter-option:hover {
    background-color: #f0f4f8;
}

.filter-option input {
    margin-right: 8px;
    cursor: pointer;
}

.filter-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    font-size: 0.9rem;
    color: #666;
}

.clear-filters {
    background: transparent;
    border: 1px solid #d32f2f;
    color: #d32f2f;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.clear-filters:hover {
    background: #d32f2f;
    color: white;
}

/* ========== ПОИСК ========== */
.header-search {
    position: relative;
    margin-left: auto;
    margin-right: 0;
    display: flex;
    align-items: center;
    z-index: 1100;
    height: 44px;
    flex-shrink: 0;
}

.search-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
}

.search-icon:hover {
    background: rgba(255, 255, 255, 0.25);
}

.search-expanded {
    position: absolute;
    right: 0;
    top: 0;
    width: 0;
    overflow: visible;
    opacity: 0;
    transform: scaleX(0);
    transform-origin: right center;
    transition: all 0.3s ease;
    z-index: 1101;
}

.search-expanded.active {
    width: 320px;
    opacity: 1;
    transform: scaleX(1);
}

.search-expanded #headerSearch {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 16px;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
    height: 44px;
    box-sizing: border-box;
    line-height: 1.2;
}

.search-expanded #headerSearch::placeholder {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.search-expanded.active #headerSearch:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.search-results {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    max-height: 300px;
    overflow-y: auto;
    width: 350px;
    z-index: 1102;
    display: none;
    margin-top: 8px;
    border: 1px solid #e0e0e0;
    -webkit-overflow-scrolling: touch;
}

.search-result-item {
    text-decoration: none !important;
    color: inherit;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    min-height: 48px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-main {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.search-result-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    min-width: 0;
}

.search-result-region {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.search-result-rank {
    font-size: 11px;
    color: #888;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: 8px;
    white-space: nowrap;
    flex-shrink: 0;
    border: 1px solid #e0e0e0;
    font-weight: 500;
}

.search-result-item.no-results {
    justify-content: center;
    color: #999;
    font-style: italic;
    background: transparent !important;
}

.search-active .back-button span {
    max-width: 0 !important;
    opacity: 0 !important;
    margin-right: 0 !important;
}

.search-active .athlete-name-header {
    opacity: 0 !important;
}

.search-icon i {
    color: white;
    font-size: 0.9rem;
}

/* ========== МОДАЛЬНОЕ ОКНО ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content.compact {
    background: white;
    margin: 5% auto;
    padding: 0 15px 15px 15px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header.compact {
    background: linear-gradient(135deg, #1a3a5f, #2c5a8a);
    color: white;
    text-align: center;
    margin: 0 -15px 15px -15px;
    padding: 12px 15px;
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.event-status {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.event-name {
    font-size: 1.2rem;
    color: white;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.2;
}

.event-location {
    font-size: 0.9rem;
    color: white;
    font-weight: 500;
    margin-bottom: 4px;
    line-height: 1.2;
}

.event-date {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
}

.modal-grid.compact {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    min-height: 24px;
}

.info-label {
    font-size: 0.75rem;
    color: #666;
    font-weight: 600;
    min-width: 70px;
    flex-shrink: 0;
}

.info-value {
    font-size: 0.85rem;
    color: #1a3a5f;
    font-weight: 500;
    flex: 1;
}

.modal-section.compact {
    margin-bottom: 12px;
    background: none;
    padding: 0;
    box-shadow: none;
    border: none;
}

.modal-section-title {
    font-size: 0.9rem;
    color: #1a3a5f;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.athletes-list.compact {
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.athletes-list.compact li {
    padding: 4px 6px;
    font-size: 0.8rem;
    border-radius: 3px;
    background: #f8f9fa;
    border: 1px solid #eaeaea;
    margin-bottom: 2px;
}

.place-badge-modal {
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    display: inline-block;
    text-align: center;
}

.results-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.8rem;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item.athlete-result {
    background-color: #e9f5ff;
    border-left: 3px solid #2c5a8a;
    font-weight: 600;
}

.result-place {
    font-weight: 600;
    min-width: 30px;
}

.result-name {
    flex: 1;
    margin: 0 8px;
}

.result-time {
    color: #666;
    font-family: monospace;
}

.result-gap {
    color: #d32f2f;
    font-family: monospace;
    margin-left: 8px;
}

.close {
    position: absolute;
    right: 12px;
    top: 12px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    transition: all 0.3s ease;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 1;
}

.close:hover {
    color: #d32f2f;
    background: #ffebee;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background-color: #e9f5ff !important;
}

/* ========== РЕЙТИНГИ ========== */
.ratings-container {
    margin: 15px 0;
}

.rating-category {
    margin-bottom: 0;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #eaeaea;
    font-weight: 600;
    color: #1a3a5f;
    font-size: 0.9rem;
    justify-content: center;
}

.category-header i {
    color: #2c5a8a;
    font-size: 0.9rem;
}

.rating-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex-direction: column;
}

.rating-main {
    flex-shrink: 0;
    min-width: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.current-rating {
    font-size: 1.9rem;
    font-weight: 700;
    color: #1a3a5f;
    line-height: 1;
    margin-bottom: 2px;
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 4px;
    justify-content: center;
}

.current-rating:not(:has(.fa-question-circle)) {
    display: block;
    text-align: center;
}

.current-rating:has(.fa-question-circle) {
    display: inline-grid;
    grid-template-columns: max-content max-content;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.current-position {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
    text-align: center;
}

.rating-side {
    display: flex;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
    min-width: 200px;
}

.rating-changes {
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    background: #f8f9fa;
    border-radius: 8px;
    flex: 1;
    min-width: 85px;
    justify-content: space-around;
}

.change-year {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.year {
    font-size: 0.7rem;
    color: #666;
    font-weight: 500;
}

.change {
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 28px;
    text-align: right;
}

.change.positive {
    color: #2e7d32;
}

.change.negative {
    color: #c62828;
}

.rating-best {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px;
    background: #fff8e1;
    border-radius: 8px;
    border: 1px solid #ffecb3;
    flex: 1;
    min-width: 75px;
    gap: 2px;
    position: relative;
}

.best-label {
    font-size: 0.7rem;
    color: #ff6f00;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 1px;
}

.best-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ff6f00;
    line-height: 1;
    margin-bottom: 1px;
}

.best-date {
    font-size: 0.7rem;
    color: #8d6e63;
    font-weight: 500;
}

.category-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #e0e0e0, transparent);
    margin: 15px 0;
}

.corner-icon {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    color: #ff6f00;
    opacity: 0.5;
    transition: all 0.2s ease;
    z-index: 1;
}

.corner-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

.corner-icon i {
    font-size: 0.8rem;
}

/* ========== ИКОНКИ ========== */
.icons-group {
    display: flex;
    gap: 0;
}

.filter-option .filter-icons {
    display: inline-flex;
    gap: 0 !important;
    margin-right: 4px;
}

.filter-option .filter-icons i {
    margin: 0 !important;
    margin-left: -4px !important;
}

.text-link-icon {
    display: inline-flex;
    align-items: baseline;
    margin-left: 6px;
    vertical-align: baseline;
    text-decoration: none;
    line-height: 0;
    color: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    -webkit-tap-highlight-color: transparent;
}

.text-link-icon:hover {
    opacity: 0.7;
}

.text-link-icon i {
    display: inline-block;
    font-size: 0.75em !important;
    line-height: inherit;
    margin-left: 4px;
}

.fa-question-circle {
    cursor: pointer;
    color: #ff6f00;
    margin-left: 4px;
    font-size: 0.85em;
    opacity: 0.7;
    transition: all 0.2s ease;
    vertical-align: middle;
    position: relative;
    z-index: 2;
}

.fa-question-circle:hover {
    color: #4CAF50;
    opacity: 1;
    transform: scale(1.1);
}

/* ========== ТУЛТИПЫ ========== */
.rating-tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    width: 320px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: none;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #333;
    animation: tooltipFadeInCenter 0.3s ease-out;
}

.rating-tooltip.show {
    display: block;
}

.rating-tooltip h4 {
    margin: 0 0 5px 0;
    color: #1a3a5f;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    padding: 0 16px;
}

.rating-tooltip p {
    margin: 0 0 10px 0;
    text-align: justify;
}

.rating-tooltip p:last-child {
    margin-bottom: 0;
}

.rating-tooltip .tip-note {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}

.tooltip-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.tooltip-close:hover {
    background: #e0e0e0;
    color: #333;
}

@keyframes tooltipFadeInCenter {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.tooltip-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 9999;
    display: none;
    animation: overlayFadeIn 0.3s ease-out;
}

.tooltip-overlay.show {
    display: block;
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ========== КАРТОЧКА СОРЕВНОВАНИЙ ========== */
.competitions-stats {
    background: white;
    border: none;
}

.competitions-summary {
    margin-top: 5px;
}

.total-count {
    text-align: center;
    margin-bottom: 10px;
    padding: 6px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #1a3a5f;
    border: 1px solid #eaeaea;
}

.total-value {
    font-size: 1.9rem;
    font-weight: 700;
    display: block;
    line-height: 1;
    margin-bottom: 2px;
    color: #1a3a5f;
}

.total-label {
    font-size: 0.85rem;
    color: #666;
    letter-spacing: 0.5px;
}

.stats-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.breakdown-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #eaeaea;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    color: #2c5a8a;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 1px solid #eaeaea;
    padding-bottom: 8px;
}

.section-header i {
    color: #2c5a8a;
    font-size: 1rem;
}

/* ========== ГОДОВЫЕ БАРЫ ========== */
.year-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-bar-item {
    display: grid;
    grid-template-columns: 45px 1fr auto;
    align-items: center;
}

.bar-label {
    font-weight: 600;
    color: #666;
    font-size: 0.85rem;
}

.bar-container {
    width: 100%;
    height: 10px;
    background: #eaeaea;
    border-radius: 5px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2c5a8a, #4a7cb0);
    border-radius: 5px;
}

.bar-value {
    color: #1a3a5f;
    font-weight: 700;
    font-size: 0.85rem;
    text-align: right;
    white-space: nowrap;
    min-width: 30px;
}

/* ========== ДИСЦИПЛИНЫ ========== */
.discipline-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.discipline-item {
    display: grid;
    grid-template-columns: 32px 80px 1fr auto;
    align-items: center;
}

.discipline-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: #f0f4f8 !important;
}

.discipline-icon i {
    font-size: 1rem;
}

.discipline-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.discipline-name {
    font-size: 0.8rem;
    color: #666;
    white-space: nowrap;
}

.discipline-count {
    font-weight: 600;
    color: #1a3a5f;
    font-size: 1rem;
    line-height: 1.2;
}

.discipline-bar {
    width: 100%;
    height: 10px;
    background: #eaeaea;
    border-radius: 5px;
    overflow: hidden;
}

.bar-progress {
    height: 100%;
    background: linear-gradient(90deg, #2c5a8a, #6d9fd1);
    border-radius: 5px;
}

.discipline-value {
    color: #1a3a5f;
    font-weight: 700;
    font-size: 0.85rem;
    text-align: right;
    white-space: nowrap;
    min-width: 30px;
}

/* ========== ВИДЫ ПРОГРАММ ========== */
.types-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.type-item {
    text-align: center;
    padding: 8px 4px;
    background: white;
    border-radius: 6px;
    border: 1px solid #eaeaea;
}

.type-icon {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.type-details {
    display: flex;
    flex-direction: column;
}

.type-name {
    font-size: 0.7rem;
    color: #666;
}

.type-count {
    font-weight: 600;
    color: #1a3a5f;
    font-size: 1rem;
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (min-width: 769px) {
    .filter-dropdown-content.upward {
        top: auto;
        bottom: 100%;
        margin-top: 0;
        margin-bottom: 4px;
    }
}

@media (max-width: 768px) {
    .competition-table {
        min-width: auto;
        width: 100%;
        font-size: 0.6rem;
        line-height: 1.1;
    }

    .competition-table th,
    .competition-table td {
        padding: 2px 3px;
    }

    .competition-table td:nth-child(3) {
        white-space: nowrap;
        font-size: 0.8rem;
    }

    .competition-table td:last-child {
        min-width: 60px;
    }

    .container {
        padding: 8px;
    }

    .competition-history {
        padding: 12px 8px;
    }

    .competition-table td:nth-child(2) {
        white-space: normal;
        word-break: break-word;
    }

    .competition-table th .full-text {
        display: none;
    }

    .competition-table th .short-text {
        display: inline;
    }

    .modal-content.compact {
        margin: 10% auto;
        padding: 0 12px 12px 12px;
        width: 95%;
        max-width: 380px;
    }

    .modal-header.compact {
        margin: 0 -12px 12px -12px;
        padding: 12px 15px;
    }

    .info-label {
        min-width: 60px;
        font-size: 0.7rem;
    }

    .info-value {
        font-size: 0.8rem;
    }

    .event-name {
        font-size: 1rem;
    }

    .modal-grid.compact {
        gap: 3px;
    }

    .info-row {
        padding: 3px 0;
        min-height: 22px;
    }

    .compact-filters {
        flex-direction: column;
    }

    .filter-dropdown {
        width: 100%;
    }

    .filter-dropdown-btn {
        width: 100%;
        min-width: auto;
    }

    .filter-dropdown-content {
        width: 100%;
        min-width: auto;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
    }

    .header-search {
        height: 44px;
    }

    .search-expanded.active {
        width: 280px;
    }

    .search-expanded #headerSearch {
        height: 44px;
        padding: 10px 14px;
    }

    .search-results {
        width: 300px;
    }

    .search-result-item {
        padding: 10px 12px;
        min-height: 44px;
    }

    .search-result-name {
        font-size: 13px;
    }

    .search-result-region {
        font-size: 11px;
    }

    .search-result-rank {
        font-size: 10px;
        padding: 1px 4px;
    }

    .search-results {
        max-height: 50vh;
    }

    .rating-tooltip {
        width: 280px;
        max-width: 85vw;
        font-size: 0.8rem;
        padding: 14px;
    }

    .rating-tooltip h4 {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }

    .fa-question-circle {
        font-size: 0.9em;
        margin-left: 6px;
        min-width: 18px;
        min-height: 18px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Адаптивность для баров */
    .bar-container {
        height: 8px;
    }

    .discipline-item {
        grid-template-columns: 28px 70px 1fr auto;
    }

    .discipline-bar {
        height: 8px;
    }

    .discipline-icon {
        width: 28px;
        height: 28px;
    }

    .discipline-icon i {
        font-size: 0.9rem;
    }

    .discipline-name {
        font-size: 0.75rem;
    }

    .discipline-count {
        font-size: 0.9rem;
    }

    .discipline-info {
        min-width: 70px;
    }

    .types-stats {
        gap: 4px;
    }

    .type-icon {
        font-size: 1rem;
    }

    .type-count {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .modal-content.compact {
        margin: 5% auto;
        padding: 0 10px 10px 10px;
    }

    .modal-header.compact {
        margin: 0 -10px 10px -10px;
        padding: 12px 15px;
    }

    .info-label {
        min-width: 55px;
    }

    .compact-filters {
        padding: 12px;
    }

    .filter-dropdown-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .clear-filters span {
        display: none;
    }

    .clear-filters {
        padding: 8px;
    }

    .filter-option {
        font-size: 0.85rem;
        padding: 6px 10px;
    }

    .search-expanded.active {
        width: 250px;
    }

    .search-expanded #headerSearch {
        height: 44px;
        padding: 10px 12px;
    }

    .search-results {
        width: 300px;
    }

    .rating-tooltip {
        width: 260px;
        max-width: 80vw;
        padding: 12px;
    }

    /* Адаптивность для баров */

    .bar-value {
        font-size: 0.8rem;
    }

    .discipline-item {
        grid-template-columns: 24px 65px 1fr auto;
    }

    .discipline-value {
        font-size: 0.8rem;
    }

    .breakdown-section {
        padding: 10px;
    }

    .discipline-item {
        flex-wrap: wrap;
    }
}

@media (max-width: 360px) {
    .rating-tooltip {
        width: 240px;
        max-width: 75vw;
    }

    .corner-icon {
        width: 18px;
        height: 18px;
    }

    .corner-icon i {
        font-size: 0.8rem;
    }
}

@media (max-width: 350px) and (min-width: 0) {
    body {
        min-width: 349px !important;
        overflow-x: auto !important;
        padding-right: 5px !important;
    }
}

/* ========== ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ ========== */
.hidden {
    display: none !important;
}

.empty-table-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
    background: white;
    border-radius: 0 0 10px 10px;
    border-top: 1px solid #eaeaea;
}

.empty-table-message.hidden {
    display: none;
}

/* ========== ФУТЕР ========== */
footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: #666;
    font-size: 0.9rem;
    border-top: 1px solid #eaeaea;
}