* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #0a0e1a;
    color: #e2e8f0;
    min-height: 100vh;
}

.header {
    background: #1a1f35;
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2d3548;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3em;
    font-weight: bold;
    color: #60d4f2;
}

.logo-icon {
    font-size: 1.5em;
}

.header-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    color: #e2e8f0;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background 0.2s;
}

.nav-link:hover {
    background: #2d3548;
}

.dashboard-btn {
    background: #60d4f2;
    color: #0a0e1a;
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.dashboard-btn:hover {
    background: #4fc3e1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    text-decoration: none;
    margin-bottom: 30px;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s;
}

.back-link:hover {
    background: #1a1f35;
    color: #e2e8f0;
}

.tournament-header {
    background: #1a1f35;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid #2d3548;
}

.tournament-title {
    font-size: 2em;
    color: #60d4f2;
    margin-bottom: 15px;
}

.tournament-meta {
    display: flex;
    gap: 30px;
    color: #94a3b8;
    margin-bottom: 20px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-primary {
    background: #60d4f2;
    color: #0a0e1a;
    font-weight: bold;
}

.btn-primary:hover {
    background: #4fc3e1;
}

.btn-secondary {
    background: #2d3548;
    color: #e2e8f0;
}

.btn-secondary:hover {
    background: #3d4558;
}

.rankings-section {
    background: #1a1f35;
    border-radius: 12px;
    padding: 30px;
    border: 1px solid #2d3548;
    /*
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 400px);
    */
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    /* flex-shrink: 0; */
}

.section-title {
    font-size: 1.5em;
    color: #e2e8f0;
}

.filter-select {
    background: #0a0e1a;
    color: #e2e8f0;
    border: 1px solid #2d3548;
    padding: 8px 30px 8px 12px;
    border-radius: 6px;
    font-size: 0.95em;
    cursor: pointer;
}

.rankings-table {
    width: 100%;
    border-collapse: collapse;
}

.table-wrapper {
    overflow-y: auto;
    max-height: 1800px;
    border-radius: 8px;
}

.table-wrapper::-webkit-scrollbar {
    width: 10px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #0f1320;
    border-radius: 5px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #2d3548;
    border-radius: 5px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #3d4558;
}

.rankings-table thead {
    background: #0f1320;
    border-bottom: 2px solid #2d3548;
    /*
    position: sticky;
    top: 0;
    z-index: 10;
    */
}

.rankings-table th {
    padding: 15px;
    text-align: left;
    color: #60d4f2;
    font-weight: 600;
    font-size: 0.9em;
}

.rankings-table th:first-child {
    text-align: center;
    width: 100px;
}

.rankings-table th:nth-child(3),
.rankings-table th:nth-child(4),
.rankings-table th:nth-child(5),
.rankings-table th:nth-child(6),
.rankings-table th:nth-child(7),
.rankings-table th:nth-child(8) {
    text-align: center;
}

.team-row {
    border-bottom: 1px solid #2d3548;
    transition: background 0.2s;
}

.team-row:hover {
    background: #0f1320;
}

.team-row.rank-1 {
    background: rgba(255, 215, 0, 0.05);
    font-size: 1.1em;
}

.team-row.rank-2 {
    background: rgba(192, 192, 192, 0.05);
}

.team-row.rank-3 {
    background: rgba(205, 127, 50, 0.05);
}

.rankings-table td {
    padding: 20px 15px;
}

.rankings-table td:nth-child(3),
.rankings-table td:nth-child(4),
.rankings-table td:nth-child(5),
.rankings-table td:nth-child(6),
.rankings-table td:nth-child(7),
.rankings-table td:nth-child(8) {
    text-align: center;
}

.rank-cell {
    text-align: center;
    font-size: 1.3em;
    font-weight: bold;
    color: #60d4f2;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.rank-cell .crown-icon {
    font-size: 1.1em;
}

.rank-1 .rank-cell {
    color: #ffd700;
}

.rank-2 .rank-cell {
    color: #c0c0c0;
}

.rank-3 .rank-cell {
    color: #cd7f32;
}

.team-name {
    font-weight: 600;
    color: #e2e8f0;
    font-size: 1.05em;
}

.score-cell {
    color: #60d4f2;
    font-weight: bold;
    font-size: 1.1em;
}

.match-details-section {
    background: #0f1320;
    padding: 20px;
    margin: 10px 0;
}

.match-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.match-details-title {
    color: #94a3b8;
    font-size: 0.95em;
}

.match-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.match-card {
    background: #1a1f35;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #2d3548;
}

.match-card-title {
    color: #60d4f2;
    font-weight: bold;
    margin-bottom: 10px;
}

.match-stats {
    display: grid;
    gap: 8px;
}

.match-stat {
    display: flex;
    justify-content: space-between;
    color: #94a3b8;
    font-size: 0.9em;
}

.match-stat-value {
    color: #e2e8f0;
    font-weight: 600;
}

.score-breakdown {
    display: flex;
    align-items: center;
    gap: 20px;
}

.chart-container {
    position: relative;
    width: 120px;
    height: 120px;
}

.chart-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.chart-total {
    font-size: 1.8em;
    font-weight: bold;
    color: #e2e8f0;
}

.chart-label {
    font-size: 0.75em;
    color: #94a3b8;
}

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.legend-color.placement {
    background: #a78bfa;
}

.legend-color.elimination {
    background: #60d4f2;
}

.legend-text {
    color: #94a3b8;
    font-size: 0.9em;
}

.legend-value {
    color: #e2e8f0;
    font-weight: 600;
    margin-left: auto;
}

.expand-btn {
    background: none;
    border: none;
    color: #60d4f2;
    cursor: pointer;
    padding: 5px;
    font-size: 1.2em;
}

.details-hidden {
    display: none;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
    }
    
    .tournament-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .rankings-table {
        font-size: 0.85em;
    }
    
    .match-grid {
        grid-template-columns: 1fr;
    }
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    padding: 20px;
}

.pagination-btn {
    background: #2d3548;
    color: #e2e8f0;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-number {
    background: #2d3548;
    color: #e2e8f0;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    min-width: 40px;
}

.page-number.active {
    background: #60d4f2;
    color: #0a0e1a;
    font-weight: bold;
}

