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

html.js-loading .tab-content {
    display: none !important;
}

html.js-loading .tabs {
    visibility: hidden;
}

body {
    background: linear-gradient(135deg, #1a3a5f, #2c5a8a);
    color: white;
    padding: 10px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.header {
    text-align: center;
    margin-bottom: 20px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 5px;
}

.header-logo {
    width: 4.5em;
    height: 4.5em;
    object-fit: contain;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}

.header-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.header-title .title-line:first-child {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.header-title .title-line:last-child {
    font-size: 1.5rem;
    font-weight: 400;
    opacity: 0.9;
    margin-top: 2px;
    line-height: 1.1;
}

.tabs-section {
    margin-bottom: 10px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
}

.tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.tab {
    flex: 1;
    padding: 16px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 1rem;
    position: relative;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab.active {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 -3px 0 #4fc3f7;
}

.tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.15);
}

.tab i {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.tab-text {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
    flex: 1;
    min-height: 500px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-content.active {
    display: block;
}

.search-section {
    margin-bottom: 15px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    position: relative;
}

.search-input {
    flex: 1;
    padding: 4px 10px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1rem;
    backdrop-filter: blur(10px);
    padding-right: 40px !important;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
}

.search-stats {
    text-align: center;
    opacity: 0.8;
    font-size: 0.9rem;
}

.initial-state {
    text-align: center;
    padding: 40px 20px;
    opacity: 0.7;
}

.initial-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.initial-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.initial-state p {
    font-size: 1rem;
    line-height: 1.5;
}

.min-chars-warning {
    text-align: center;
    padding: 40px 20px;
    opacity: 0.7;
}

.min-chars-warning i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    opacity: 0.7;
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 15px;
}

.athletes-list, .ratings-list {
    display: grid;
    gap: 150px;
}

.events-list {
    display: grid;
    gap: 8px;
}

.athlete-card, .rating-card, .event-card {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-decoration: none;
    color: white;
    display: block;
    margin-bottom: 3px;
}

.event-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: auto;
    align-items: center;
}

.rating-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: auto;
}

.athlete-card:hover, .rating-card:hover, .event-card:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.event-card:hover, .rating-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.athlete-header, .rating-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.event-left, .rating-left {
    flex: 1;
    min-width: 0;
}

.event-logo, .rating-logo {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.event-logo.has-logo, .rating-logo.has-logo {
    background: white;
}

.event-logo i, .rating-logo i {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.7);
}

.event-logo img, .rating-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.athlete-name {
    font-size: 1.2rem;
    font-weight: 600;
    flex: 1;
}

.athlete-birth {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-left: 10px;
}

.athlete-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    opacity: 0.9;
}

.athlete-region {
    display: flex;
    align-items: center;
    gap: 5px;
}

.athlete-rank {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.8rem;
}

.rating-name {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 4px;
}

.event-name {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 4px;
}

.athlete-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.event-details, .rating-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.8rem;
    opacity: 0.9;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.gender-m {
    color: #4fc3f7;
}

.gender-f {
    color: #f06292;
}

.rank-badge {
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    display: inline-block;
}

.rank-badge.rank-ms {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    color: #333;
    border: 1px solid #FFA000;
}

.rank-badge.rank-kms {
    background: linear-gradient(135deg, #C0C0C0, #808080);
    color: white;
    border: 1px solid #808080;
}

.event-type-badge {
    background: linear-gradient(135deg, #4fc3f7, #0288d1);
    color: white;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.year-badge {
    background: linear-gradient(135deg, #66bb6a, #388e3c);
    color: white;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.year-badge.even-year {
    background: linear-gradient(135deg, #ffa726, #f57c00);
}

.badges-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.footer {
    text-align: center;
    margin-top: 0px;
    padding-top: 10px;
    padding-bottom: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0.7;
    font-size: 0.9rem;
}

.clear-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: none;
    padding: 5px;
    font-size: 0.9rem;
}

.clear-btn:hover {
    color: white;
}

.compact-filters {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    margin-left: auto;
    margin-right: auto;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 0 5px;
}

.filter-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 1.2rem;
}

.filter-header-left i {
    font-size: 1.2rem;
    color: #4fc3f7;
}

.toggle-filters-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.toggle-filters-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.filters-body {
    transition: all 0.3s ease;
    overflow: visible !important;
    position: relative;
    display: none;
}

.filters-body.show {
    display: block;
}

.filters-body.collapsed {
    display: none;
}

.filters-grid {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 5px;
    align-items: stretch;
}

.filter-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    display: none;
}

.filter-dropdown.visible {
    display: flex;
}

.filter-dropdown-btn {
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: white;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 100px;
    justify-content: space-between;
    font-size: 0.9rem;
}

.filter-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
}

.filter-dropdown-btn.has-selection {
    background: rgba(79, 195, 247, 0.2);
    border-color: #4fc3f7;
    color: #4fc3f7;
    font-weight: 600;
}

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

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

.filter-dropdown-content.upward {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 4px;
}

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

.filter-option:hover {
    background: rgba(255, 255, 255, 0.15);
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
    margin-right: 8px;
    cursor: pointer;
    accent-color: #4fc3f7;
}

.filter-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    width: 100%;
    justify-content: flex-end;
}

.clear-filters {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
    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: #ff6b6b;
    color: white;
}

.icon-circle {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.icon-circle:hover {
    transform: scale(1.1);
}

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

.competition-icons-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
}

.people-quatro::before {
    color: white !important;
    font-size: 0.9rem;
}

.filter-dropdown-btn.has-selection .people-quatro::before {
    color: #4fc3f7 !important;
}

.filter-header-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
    margin-bottom: 8px;
}

.filters-body.collapsed .filter-header-divider {
    display: none;
}

.events-search-box {
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
    width: 300px;
}

.events-search-box i {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    min-width: 24px;
    text-align: center;
}

.events-search-box .search-input {
    flex: 1;
    padding-right: 40px !important;
}

.events-search-box .clear-btn {
    position: absolute;
    right: 0px;
    top: 50%;
    transform: translateY(-50%);
}

.filter-icon-left {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
    min-width: 24px;
    text-align: center;
    transition: color 0.2s;
}

.filter-dropdown.has-selection .filter-icon-left {
    color: #4fc3f7;
}

.search-icon-wrapper {
    position: absolute;
    left: 7px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.search-icon-wrapper i {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
}

.events-search-box .search-input {
    flex: 1;
    padding: 4px 10px 6px 35px !important;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 0.9rem;
    width: 100%;
}

.events-search-box .search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
}

.events-search-box .clear-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: none;
    padding: 5px;
    z-index: 1;
}

.events-search-box .clear-btn:hover {
    color: white;
}

.filter-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-stats-left,
.filter-stats-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-stats-right {
    margin-left: auto;
}

.add-filters-btn {
    background: rgba(79, 195, 247, 0.2);
    border: 1px solid #4fc3f7;
    color: #4fc3f7;
    padding: 8px 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.add-filters-btn:hover {
    background: #4fc3f7;
    color: white;
}

.filters-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #2c5a8a;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    min-width: 230px;
    z-index: 1002;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

.filter-group-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: white;
    font-size: 0.9rem;
}

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

.filter-group-item:hover {
    background: rgba(79, 195, 247, 0.2);
}

.filter-group-item i {
    width: 24px;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s ease;
}

.filter-group-item i.active {
    color: #4fc3f7;
}

.filter-stats-left {
    position: relative;
}

.filter-actions-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.filter-action-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 5px 3px;
    color: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.filter-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.select-all-btn {
    border-color: #4fc3f7;
    color: #4fc3f7;
}

.select-all-btn:hover {
    background: rgba(79, 195, 247, 0.2);
}

.deselect-all-btn {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.deselect-all-btn:hover {
    background: rgba(255, 107, 107, 0.2);
}

/* Кнопка добавления события */
.add-event-btn {
    background: linear-gradient(135deg, #4fc3f7, #0288d1);
    border: none;
    border-radius: 10px;
    padding: 6px 12px;
    margin-bottom: 6px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.add-event-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 195, 247, 0.4);
}

@media (max-width: 768px) {
    .container {
        padding: 5px;
    }
    .athlete-details {
        grid-template-columns: 1fr;
    }
    .search-box {
        flex-direction: column;
    }
    .initial-state {
        padding: 30px 15px;
    }
    .initial-state i {
        font-size: 3rem;
    }
    .tabs {
        flex-direction: row;
        overflow: hidden;
    }
    .tab {
        padding: 14px 12px;
        font-size: 0.9rem;
    }
    .tab i {
        font-size: 1rem;
    }
    .header-logo {
        width: 4em;
        height: 4em;
    }
    .header-title .title-line:first-child {
        font-size: 2rem;
    }
    .header-title .title-line:last-child {
        font-size: 1.2rem;
    }
    .filter-header-left {
        font-size: 1rem;
    }
    .filter-header-left i {
        font-size: 1rem;
    }
    .search-input {
        padding: 4px 10px;
    }
}

@media (max-width: 600px) {
    .tab {
        padding: 12px 6px;
        gap: 4px;
    }
    .tab i {
        font-size: 1.2rem;
    }
    .tabs-section {
        margin-bottom: 8px;
        padding-bottom: 8px;
    }
    .tab-text {
        font-size: 0.6rem;
    }
    .filter-header-left {
        font-size: 0.9rem;
    }
    .filter-header-left i {
        font-size: 0.9rem;
    }
}

@media (max-width: 400px) {
    .tab {
        padding: 10px 6px;
    }
    .tab i {
        font-size: 1.1rem;
    }
    .header-logo {
        width: 3.5em;
        height: 3.5em;
    }
    .header-title .title-line:first-child {
        font-size: 1.9rem;
    }
    .header-title .title-line:last-child {
        font-size: 1.1rem;
    }
}

@media (max-width: 334px) and (min-width: 0) {
    body {
        min-width: 335px !important;
        overflow-x: auto !important;
        background: linear-gradient(135deg, #1a3a5f, #2c5a8a) fixed !important;
    }
}