* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    color: white;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    font-size: 2.2em;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    color: #FFD700;
    flex: 1;
    text-align: center;
    line-height: 1.3;
}

.previous-tournament-button {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    max-width: 280px;
    min-width: 180px;
}

.rating-tab-button {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    width: 200px;
    min-width: 180px;
}

.tournament-info {
    margin-bottom: 10px;
}

.tournament-phase {
    font-size: 1.4em;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 10px;
    flex-wrap: wrap;
}

.tab-button {
    background: none;
    border: none;
    color: white;
    padding: 10px 15px;
    margin: 5px;
    border-radius: 25px;
    font-size: 0.9em;
    cursor: pointer;
    min-width: 150px;
}

.tab-button:hover {
    background: rgba(255,255,255,0.2);
}

.tab-button.active {
    background: #4CAF50;
    font-weight: bold;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.rating-header {
    text-align: center;
    margin-bottom: 20px;
}

.rating-header h2 {
    font-size: 2.5em;
    color: #FFD700;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.stat-item {
    text-align: center;
    background: rgba(255,255,255,0.1);
    padding: 25px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    overflow-x: auto;
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #4CAF50;
}

.stat-label {
    font-size: 1.1em;
    opacity: 0.9;
}

.stat-dates {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.date-label {
    font-size: 0.9em;
    opacity: 0.8;
}

.date-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #4CAF50;
}

.search-container {
    margin: 30px 0;
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 10px;
    position: relative;
}

.search-box {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
}

#searchInput {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    background: rgba(255,255,255,0.95);
    color: #333;
}

.clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

.clear-search:hover {
    background: #f0f0f0;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 10px 10px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    color: #333;
    border-bottom: 1px solid #eee;
}

.autocomplete-item:hover {
    background: #f5f5f5;
}

.autocomplete-highlight {
    background: #FFD700;
    font-weight: bold;
}

.search-results {
    text-align: center;
    margin-top: 10px;
    color: rgba(255,255,255,0.8);
    font-size: 0.9em;
}

.expand-button {
    display: block;
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 1em;
    cursor: pointer;
    margin: 10px auto;
    width: 200px;
}

.tournament-table {
    width: 100%;
    background: rgba(255,255,255,0.95);
    color: #333;
    border-radius: 10px;
    overflow-x: auto;
    margin-top: 20px;
    font-size: 0.9em;
    border-collapse: collapse;
}

.tournament-table th,
.tournament-table td {
    padding: 12px 8px;
    text-align: center;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.tournament-table th {
    background: #2c3e50;
    color: white;
}

.tournament-table tr:hover {
    background: #f5f5f5;
}

.rating-highlight {
    background: #fff9c4 !important;
}

.rating-highlight:hover {
    background: #fff59d !important;
}

.search-highlight {
    background: #ffeb3b !important;
}

.player-name {
    font-weight: bold;
    text-align: left !important;
    padding-left: 15px !important;
    color: #2c3e50;
    font-size: 1em;
}

.number-column {
    font-weight: bold;
}

/* МОБИЛЬНЫЕ ПРАВИЛА */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header-top {
        flex-direction: column;
        align-items: center;
    }
    
    header h1 {
        font-size: 1.5em;
        order: -1;
        margin-bottom: 10px;
    }
    
    .previous-tournament-button,
    .rating-tab-button {
        width: 100%;
        max-width: 280px;
    }
    
    .stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat-item {
        padding: 15px;
    }
    
    .stat-number {
        font-size: 1.8em;
    }
    
    .tabs {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
    
    .tab-button {
        min-width: 120px;
        font-size: 0.8em;
        padding: 8px 10px;
    }
    
    .tournament-table td,
    .tournament-table th {
        padding: 10px 5px;
        font-size: 0.9em;
    }
    
    .player-name {
        font-size: 0.95em;
        padding-left: 8px !important;
    }
}

/* Десктоп */
@media (min-width: 769px) {
    .mobile-hide {
        display: table-cell;
    }
}

/* Скрытие колонок на мобиле по умолчанию */
@media (max-width: 768px) {
    .tournament-table th.mobile-hide,
    .tournament-table td.mobile-hide {
        display: none;
    }
}

/* При развернутой таблице показываем все колонки */
.tournament-table.expanded th.mobile-hide,
.tournament-table.expanded td.mobile-hide {
    display: table-cell;
}

.position-change {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    min-width: 60px;
    color: white;
}

.position-up { background: #4CAF50; }
.position-down { background: #f44336; }
.position-same { background: #ff9800; }
.position-new { background: #2196F3; }

.chips-positive {
    color: #2E7D32;
    font-weight: bold;
    background: #e8f5e9;
    border-radius: 8px;
    padding: 5px 8px;
    display: inline-block;
}

.attendance-value {
    background: #e3f2fd;
    color: #1976D2;
    font-weight: bold;
    border-radius: 8px;
    padding: 5px 8px;
    display: inline-block;
}

.rating-positive {
    color: #2E7D32;
    font-weight: bold;
}

.rating-negative {
    color: #C62828;
    font-weight: bold;
}

.rating-number {
    font-weight: bold;
    color: #2c3e50;
}

.special-tab-content {
    text-align: center;
    background: rgba(255,255,255,0.1);
    padding: 40px;
    border-radius: 15px;
    margin-top: 20px;
}

.special-tab-content h2 {
    font-size: 2.5em;
    color: #FFD700;
}

.special-date {
    font-size: 1.3em;
    color: #4CAF50;
    margin-bottom: 30px;
}

/* Стили для финальных результатов */
.final-gold { background: linear-gradient(90deg, #fff9c4, #fff176) !important; }
.final-silver { background: linear-gradient(90deg, #e0e0e0, #bdbdbd) !important; }
.final-bronze { background: linear-gradient(90deg, #ffe0b2, #ffcc80) !important; }
.final-finalist { background: linear-gradient(90deg, #c8e6c9, #a5d6a7) !important; }
.final-participant { background: linear-gradient(90deg, #ffcdd2, #ef9a9a) !important; }

.empty-tab-message {
    text-align: center;
    background: rgba(255,255,255,0.1);
    padding: 80px 40px;
    border-radius: 15px;
}

.empty-tab-message h2 {
    font-size: 2.5em;
    color: #FFD700;
}

.col-total {
    font-weight: bold;
    background: #4CAF50;
    color: white;
}
