/* Tournament Page Styles */

/* Tournament Header */
.tournament-header {
    padding: 150px 0 80px;
    text-align: center;
    background: linear-gradient(135deg, #1a0b2e 0%, #2d1b4e 100%);
    position: relative;
    overflow: hidden;
}

.tournament-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, rgba(124, 58, 237, 0.2) 0%, transparent 70%);
}

.tournament-title {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-light), var(--accent-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 2;
}

.tournament-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    position: relative;
    z-index: 2;
}

/* Tournament Selection */
.tournament-selection {
    padding: 4rem 0;
    background: var(--bg-dark);
}

.tournaments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.btn-add-tournament {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-add-tournament:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.4);
}

.tournaments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.tournament-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 16px;
    border: 2px solid rgba(124, 58, 237, 0.2);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}

.tournament-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-cyan);
    box-shadow: 0 15px 40px rgba(124, 58, 237, 0.3);
}

.tournament-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.tournament-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.tournament-card-dates {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.tournament-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(124, 58, 237, 0.2);
}

.tournament-stat {
    text-align: center;
}

.tournament-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-cyan);
    display: block;
}

.tournament-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tournament-card-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.btn-delete-tournament {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid #ef4444;
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-delete-tournament:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Tournament Header Bar */
.tournament-header-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--text-primary);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-back:hover {
    background: rgba(124, 58, 237, 0.2);
    transform: translateX(-3px);
}

.current-tournament-name {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-light), var(--accent-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    flex: 1;
}

.btn-manage-participants {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, var(--accent-cyan), #0891b2);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-manage-participants:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(34, 211, 238, 0.4);
}

/* Participants List */
.participants-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
    border: 2px solid rgba(124, 58, 237, 0.2);
    border-radius: 12px;
    padding: 1rem;
}

.participant-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-darker);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.3s;
}

.participant-item:hover {
    background: rgba(124, 58, 237, 0.1);
}

.participant-name {
    font-weight: 600;
    color: var(--text-primary);
}

.btn-remove-participant {
    padding: 0.375rem 0.75rem;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid #ef4444;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s;
}

.btn-remove-participant:hover {
    background: rgba(239, 68, 68, 0.3);
}

.participants-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Leaderboard */
.leaderboard {
    padding: 4rem 0;
    background: linear-gradient(180deg, var(--bg-dark), rgba(124, 58, 237, 0.05));
}

.leaderboard-table {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid rgba(124, 58, 237, 0.2);
    margin-top: 2rem;
}

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

.leaderboard-table thead {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.leaderboard-table th {
    padding: 1.25rem 1rem;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.leaderboard-table th:first-child {
    text-align: center;
    width: 60px;
}

.leaderboard-table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(124, 58, 237, 0.1);
    color: var(--text-secondary);
}

.leaderboard-table td:first-child {
    text-align: center;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--accent-cyan);
}

.leaderboard-table tbody tr {
    transition: all 0.3s;
}

.leaderboard-table tbody tr:hover {
    background: rgba(124, 58, 237, 0.1);
}

.leaderboard-table tbody tr:nth-child(1) td:first-child {
    color: #FFD700;
}

.leaderboard-table tbody tr:nth-child(2) td:first-child {
    color: #C0C0C0;
}

.leaderboard-table tbody tr:nth-child(3) td:first-child {
    color: #CD7F32;
}

.player-name {
    font-weight: 600;
    color: var(--text-primary);
}

.stat-highlight {
    font-weight: 700;
    color: var(--accent-cyan);
}

.points-cell {
    font-weight: 900;
    font-size: 1.25rem;
    background: linear-gradient(135deg, var(--accent-cyan), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Matches Section */
.matches {
    padding: 4rem 0;
    background: var(--bg-dark);
}

.matches-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.btn-add-match {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-add-match:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.4);
}

.matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 2rem;
}

.match-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 2px solid rgba(124, 58, 237, 0.2);
    padding: 2rem;
    transition: all 0.3s;
}

.match-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-cyan);
    box-shadow: 0 15px 40px rgba(124, 58, 237, 0.3);
}

.match-date {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    text-align: center;
}

.match-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.player-info {
    flex: 1;
    text-align: center;
}

.player-name-match {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.player-score {
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-cyan), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.match-vs {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-muted);
}

.match-winner {
    border: 2px solid var(--accent-cyan);
    border-radius: 12px;
    padding: 0.5rem;
}

.match-winner .player-name-match {
    color: var(--accent-cyan);
}

.match-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.btn-delete {
    padding: 0.5rem 1rem;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid #ef4444;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Matchdays Container */
.matchdays-container {
    margin-top: 2rem;
}

.matchdays-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

/* Matchday Dropdown (mobile only) */
.matchday-select-wrapper {
    display: none;
    margin-bottom: 2rem;
    width: 100%;
}

.matchday-select {
    width: 100%;
    padding: 1rem;
    background: var(--bg-card);
    border: 2px solid rgba(124, 58, 237, 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.matchday-select:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
}

.matchday-select option {
    background: var(--bg-darker);
    color: var(--text-primary);
    padding: 0.5rem;
}

.matchday-tab {
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(124, 58, 237, 0.2);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    font-weight: 600;
    position: relative;
}

.matchday-tab:hover {
    background: rgba(124, 58, 237, 0.1);
    border-color: var(--primary);
}

.matchday-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary);
    color: var(--text-primary);
}

.matchday-tab.completed {
    border-color: #10b981;
}

.matchday-tab.in-progress {
    border-color: #f59e0b;
}

.tab-badge {
    margin-left: 0.5rem;
    font-size: 0.875rem;
}

/* Matches Grid New */
.matches-grid-new {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 100%;
}

.match-card-new {
    background: var(--bg-card);
    border-radius: 12px;
    border: 2px solid rgba(124, 58, 237, 0.2);
    padding: 1.5rem;
    transition: all 0.3s;
}

.match-card-new:hover {
    transform: translateY(-3px);
    border-color: var(--accent-cyan);
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.2);
}

.match-card-new.played {
    border-color: #10b981;
}

.match-number {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    text-align: center;
}

.match-result-new {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.player-info-new {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 8px;
    transition: all 0.3s;
}

.player-info-new.match-winner {
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid #10b981;
}

.player-name-new {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    word-break: break-word;
    max-width: 100%;
}

.player-score-new {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-cyan), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.match-vs-new {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.score-input {
    width: 60px;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 6px;
    color: var(--text-primary);
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
}

.score-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(124, 58, 237, 0.1);
}

.match-update-btn {
    margin-top: 1rem;
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.match-update-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(124, 58, 237, 0.4);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    border: 2px solid rgba(124, 58, 237, 0.3);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    padding: 2rem;
    border-bottom: 1px solid rgba(124, 58, 237, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--accent-cyan);
}

.modal-body {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.875rem;
    background: var(--bg-darker);
    border: 2px solid rgba(124, 58, 237, 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
}

.form-group select option {
    background: var(--bg-darker);
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-secondary {
    padding: 0.875rem 1.5rem;
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--text-primary);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: rgba(124, 58, 237, 0.2);
}

/* Active link in navbar */
.nav-links a.active {
    color: var(--accent-cyan);
    position: relative;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-cyan);
}

/* Auth Button */
.btn-auth {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: rgba(124, 58, 237, 0.2);
    border: 2px solid rgba(124, 58, 237, 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    font-size: 0.75rem;
    white-space: nowrap;
}

.btn-auth:hover {
    background: rgba(124, 58, 237, 0.3);
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
}

.btn-auth svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* Login Info */
.login-info {
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.login-info p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state-hint {
    font-size: 1rem;
    color: var(--text-muted);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .nav-links {
        gap: 1rem;
    }

    .btn-auth {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }

    .btn-auth span {
        display: none;
    }

    .btn-primary {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
        max-width: 100%;
    }

    .tournament-title {
        font-size: 2.5rem;
    }

    .tournament-subtitle {
        font-size: 1.125rem;
    }

    .matches-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .matches-grid {
        grid-template-columns: 1fr;
    }

    .matchdays-container {
        width: 100%;
        max-width: 100%;
    }

    /* Mobile compact table layout for leaderboard */
    .leaderboard-table {
        overflow: hidden !important;
        -webkit-overflow-scrolling: touch;
        display: block !important;
        border-radius: 16px;
    }

    .leaderboard-table table {
        width: 100% !important;
        min-width: 100% !important;
        table-layout: fixed;
        font-size: 0.65rem;
        display: table !important;
    }

    .leaderboard-table thead {
        display: table-header-group !important;
    }

    .leaderboard-table tbody {
        display: table-row-group !important;
    }

    .leaderboard-table tr {
        display: table-row !important;
    }

    .leaderboard-table th {
        padding: 0.25rem 0.15rem;
        font-size: 0.5rem;
        white-space: nowrap;
        display: table-cell !important;
        text-align: center;
    }

    .leaderboard-table th:first-child {
        text-align: center;
    }

    .leaderboard-table th:nth-child(2) {
        text-align: left;
        padding-left: 0.2rem;
    }

    .leaderboard-table th:nth-child(1) { width: 7%; }   /* # */
    .leaderboard-table th:nth-child(2) { width: 25%; }  /* Player */
    .leaderboard-table th:nth-child(3) { width: 7%; }   /* P */
    .leaderboard-table th:nth-child(4) { width: 7%; }   /* W */
    .leaderboard-table th:nth-child(5) { width: 7%; }   /* D */
    .leaderboard-table th:nth-child(6) { width: 7%; }   /* L */
    .leaderboard-table th:nth-child(7) { width: 8%; }   /* GF */
    .leaderboard-table th:nth-child(8) { width: 8%; }   /* GA */
    .leaderboard-table th:nth-child(9) { width: 8%; }   /* GD */
    .leaderboard-table th:nth-child(10) { width: 9%; }  /* Pts */

    .leaderboard-table td {
        padding: 0.25rem 0.15rem;
        font-size: 0.55rem;
        display: table-cell !important;
        white-space: nowrap;
        text-align: center;
    }

    .leaderboard-table td::before {
        content: none !important;
    }

    .leaderboard-table td:first-child {
        font-size: 0.6rem;
        text-align: center;
    }

    .leaderboard-table td:nth-child(2) {
        text-align: left;
        padding-left: 0.2rem;
    }

    .player-name {
        font-size: 0.55rem;
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .points-cell {
        font-size: 0.65rem;
        font-weight: 900;
    }

    .stat-highlight {
        font-weight: 700;
    }

    /* Qualification indicators on mobile */
    .leaderboard-table tbody tr.qualify-knockout {
        border-left: 3px solid #10b981;
    }

    .leaderboard-table tbody tr.qualify-playoff {
        border-left: 3px solid #f59e0b;
    }

    .leaderboard-table tbody tr.eliminated {
        border-left: 3px solid #ef4444;
    }

    /* Mobile matches styles */
    .matches-grid-new {
        grid-template-columns: 1fr !important;
        gap: 1rem;
        width: 100%;
        max-width: 100%;
    }

    .match-card-new {
        padding: 0.875rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .match-result-new {
        flex-direction: row;
        gap: 0.5rem;
        width: 100%;
    }

    .player-info-new {
        flex: 1;
        min-width: 0;
        padding: 0.5rem;
    }

    .player-name-new {
        font-size: 0.75rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    .player-score-new {
        font-size: 1.5rem;
    }

    .match-vs-new {
        font-size: 0.875rem;
        flex-shrink: 0;
    }

    .match-number {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
    }

    /* Hide button nav, show dropdown on mobile */
    .matchdays-nav {
        display: none !important;
    }

    .matchday-select-wrapper {
        display: block;
    }

    .matchday-tab {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }

    .match-result {
        flex-direction: column;
        gap: 1rem;
    }

    .match-vs {
        transform: rotate(90deg);
    }

    .nav-links {
        display: none;
    }

    .tournaments-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .btn-add-tournament,
    .btn-add-match {
        width: 100%;
        justify-content: center;
    }

    .matches {
        padding: 2rem 0;
    }

    .matches .container {
        padding: 0 0.75rem;
    }

    .score-input {
        width: 50px;
        font-size: 1rem;
        padding: 0.375rem;
    }

    .match-update-btn {
        padding: 0.625rem;
        font-size: 0.875rem;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .match-card-new {
        padding: 0.75rem;
    }

    .player-name-new {
        font-size: 0.7rem;
    }

    .player-score-new {
        font-size: 1.25rem;
    }

    .match-vs-new {
        font-size: 0.75rem;
    }

    .player-info-new {
        padding: 0.375rem;
        gap: 0.375rem;
    }
}

/* ========================================
   KNOCKOUT STAGE STYLES - TOURNAMENT BRACKET
   ======================================== */

.knockout {
    padding: 4rem 0;
    background: var(--bg-dark);
}

/* Playoff Section (Separate) */
.playoff-section {
    margin-bottom: 4rem;
    padding-bottom: 3rem;
    border-bottom: 2px solid rgba(124, 58, 237, 0.2);
}

.playoff-section-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent-orange), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.playoff-description {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1rem;
}

.playoff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.playoff-match {
    background: var(--bg-card);
    border: 2px solid rgba(251, 146, 60, 0.3);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s;
}

.playoff-match:hover {
    transform: translateY(-5px);
    border-color: var(--accent-orange);
    box-shadow: 0 10px 30px rgba(251, 146, 60, 0.3);
}

.playoff-match-header {
    text-align: center;
    font-size: 0.8rem;
    color: var(--accent-orange);
    margin-bottom: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.playoff-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.playoff-team {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem;
    border-radius: 8px;
    transition: all 0.3s;
}

.playoff-team.winner {
    background: rgba(34, 211, 238, 0.15);
    border: 2px solid var(--accent-cyan);
}

.playoff-team-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.2;
}

.playoff-team-score {
    font-size: 1.75rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-cyan), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.playoff-score-input {
    width: 60px;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(124, 58, 237, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 1.5rem;
    text-align: center;
    font-weight: bold;
}

.playoff-score-input:focus {
    outline: none;
    border-color: var(--primary);
}

.playoff-vs {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.playoff-qualifier {
    margin-top: 1rem;
    padding: 0.625rem;
    background: rgba(34, 211, 238, 0.1);
    border-radius: 8px;
    text-align: center;
}

.playoff-qualifier-text {
    font-size: 0.75rem;
    color: var(--accent-cyan);
    font-weight: 600;
}

.btn-edit-playoff {
    width: 100%;
    margin-top: 1rem;
    padding: 0.625rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit-playoff:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(124, 58, 237, 0.4);
}

/* Tournament Bracket Container */
.bracket-container {
    margin-top: 3rem;
    overflow-x: auto;
    overflow-y: visible;
    padding: 2rem 0;
    width: 100%;
}

.bracket-wrapper {
    display: flex;
    gap: 220px;
    min-width: 2680px;
    width: max-content;
    padding: 2rem;
    align-items: center;
}

/* Bracket Columns */
.bracket-column {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-width: 260px;
}

.bracket-column-title {
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--primary-light), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.bracket-matches {
    position: relative;
    min-height: 900px;
}

/* Bracket Match Card - Grid Layout */
.bracket-match {
    background: var(--bg-card);
    border: 2px solid rgba(124, 58, 237, 0.3);
    border-radius: 8px;
    padding: 0;
    width: 260px;
    height: 90px;
    transition: all 0.3s;
    box-sizing: border-box;
    position: absolute;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bracket-match:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
    z-index: 10;
}

.bracket-team {
    display: grid;
    grid-template-columns: 2fr 28px 28px 40px;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.75rem;
    border-bottom: 1px solid rgba(124, 58, 237, 0.2);
    transition: all 0.3s;
    height: 45px;
    box-sizing: border-box;
    position: relative;
}

.bracket-team:last-child {
    border-bottom: none;
}

.bracket-team.winner {
    background: rgba(34, 211, 238, 0.1);
}

.bracket-team.winner::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-cyan);
}

.bracket-team-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 0.25rem;
}

.bracket-leg-score {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: rgba(124, 58, 237, 0.15);
    padding: 0.25rem 0.15rem;
    border-radius: 4px;
    border: 1px solid rgba(124, 58, 237, 0.2);
    width: 28px;
    box-sizing: border-box;
}

.bracket-score-input {
    width: 28px;
    padding: 0.25rem 0.15rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(124, 58, 237, 0.3);
    border-radius: 4px;
    color: white;
    font-size: 0.7rem;
    text-align: center;
    font-weight: 700;
    box-sizing: border-box;
}

.bracket-score-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.15);
}

.bracket-agg-score {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 900;
    color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.2);
    padding: 0.25rem 0.2rem;
    border-radius: 5px;
    border: 2px solid rgba(34, 211, 238, 0.4);
    width: 40px;
    box-sizing: border-box;
}


/* ABSOLUTE POSITIONING - match height = 90px, gap = 20px */

/* Playoff - 8 matches */
.bracket-column:nth-child(1) .bracket-match:nth-child(1) { top: 0; }
.bracket-column:nth-child(1) .bracket-match:nth-child(2) { top: 110px; }
.bracket-column:nth-child(1) .bracket-match:nth-child(3) { top: 220px; }
.bracket-column:nth-child(1) .bracket-match:nth-child(4) { top: 330px; }
.bracket-column:nth-child(1) .bracket-match:nth-child(5) { top: 440px; }
.bracket-column:nth-child(1) .bracket-match:nth-child(6) { top: 550px; }
.bracket-column:nth-child(1) .bracket-match:nth-child(7) { top: 660px; }
.bracket-column:nth-child(1) .bracket-match:nth-child(8) { top: 770px; }

/* Round of 16 - 8 matches (same positions as playoff) */
.bracket-column:nth-child(2) .bracket-match:nth-child(1) { top: 0; }
.bracket-column:nth-child(2) .bracket-match:nth-child(2) { top: 110px; }
.bracket-column:nth-child(2) .bracket-match:nth-child(3) { top: 220px; }
.bracket-column:nth-child(2) .bracket-match:nth-child(4) { top: 330px; }
.bracket-column:nth-child(2) .bracket-match:nth-child(5) { top: 440px; }
.bracket-column:nth-child(2) .bracket-match:nth-child(6) { top: 550px; }
.bracket-column:nth-child(2) .bracket-match:nth-child(7) { top: 660px; }
.bracket-column:nth-child(2) .bracket-match:nth-child(8) { top: 770px; }

/* Quarter Finals - centrati tra coppie R16 */
.bracket-column:nth-child(3) .bracket-match:nth-child(1) { top: 55px; }
.bracket-column:nth-child(3) .bracket-match:nth-child(2) { top: 275px; }
.bracket-column:nth-child(3) .bracket-match:nth-child(3) { top: 495px; }
.bracket-column:nth-child(3) .bracket-match:nth-child(4) { top: 715px; }

/* Semi Finals - centrati tra coppie QF */
.bracket-column:nth-child(4) .bracket-match:nth-child(1) { top: 165px; }
.bracket-column:nth-child(4) .bracket-match:nth-child(2) { top: 605px; }

/* Final - centrato tra SF */
.bracket-column:nth-child(5) .bracket-match:nth-child(1) { top: 385px; }

/* Winner Column */
.winner-column {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: 100px;
}

.bracket-winner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(251, 146, 60, 0.2));
    border: 3px solid var(--accent-cyan);
    border-radius: 16px;
    min-width: 250px;
    text-align: center;
}

.winner-trophy {
    font-size: 4rem;
    animation: trophy-bounce 2s ease-in-out infinite;
}

.winner-trophy-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.bracket-save-container {
    text-align: center;
    margin-top: 2rem;
    padding: 2rem;
}

.btn-save-bracket {
    padding: 1rem 3rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.btn-save-bracket:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.6);
}

@keyframes trophy-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.winner-name {
    font-size: 1.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* TBD State */
.tbd-team {
    font-style: italic;
    color: var(--text-muted);
    opacity: 0.6;
}

.tbd-score {
    color: var(--text-muted);
    opacity: 0.4;
}

/* Mobile Responsive */
/* Bracket mantiene sempre il layout fisso - nessuna modifica responsive */
@media (max-width: 1024px) {
    .bracket-container {
        -webkit-overflow-scrolling: touch;
    }
}
