/* SVG Bracket Connectors */
.bracket-svg {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.bracket-line {
    fill: none;
    stroke: #888;
    stroke-width: 2;
}

.bracket {
    display: flex;
    gap: 80px;
    justify-content: flex-start;
    align-items: stretch;
    padding: 20px;
    width: fit-content;
    min-width: 100%;
    position: relative;
}

.round {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-width: 280px;
    gap: 0px;
}

.round-label {
    text-align: center;
    font-weight: 700;
    color: #ff5722;
    font-size: 16px;
    padding: 12px;
    background: linear-gradient(135deg, #fff5f2, #ffe8e0);
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #ff5722;
    box-shadow: 0 2px 8px rgba(238, 63, 9, 0.1);
    position: relative;
    z-index: 10;
    width: 100%;
    display: block;
}

.round-title {
    text-align: center;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 30px;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 5px;
    font-size: 14px;
}

.match {
    background: #f8f9fa;
    border: 2px solid #d0d0d0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    min-width: 280px;
}

.player {
    padding: 12px 15px;
    border-bottom: 1px solid #d0d0d0;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 45px;
    display: flex;
    align-items: center;
    background: white;
}

.player:last-child {
    border-bottom: none;
}

.player:hover {
    background: #f0f4ff;
}

.player.winner {
    background: #e8f5e9;
    font-weight: bold;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

.player.loser {
    opacity: 0.6;
    text-decoration: line-through;
    color: #999;
}

.player-name {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.player-name span:first-child {
    font-weight: 600;
    font-size: 15px;
}

.player-name-text {
    flex: 1;
    font-weight: 600;
}

.edit-name-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 5px;
    opacity: 0.3;
    transition: opacity 0.2s;
}

.player:hover .edit-name-btn {
    opacity: 1;
}

.edit-name-btn:hover {
    transform: scale(1.2);
}

.team-names {
    flex: 1;
}

.edit-team-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 5px;
}

.edit-player1-input,
.edit-player2-input {
    flex: 1;
    padding: 6px 8px;
    border: 2px solid #667eea;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    min-width: 90px;
    width: 100%;
}

.score {
    font-weight: bold;
    color: #667eea;
    font-size: 18px;
    min-width: 35px;
    text-align: right;
    padding: 2px 8px;
    background: #f0f0f0;
    border-radius: 4px;
    transition: all 0.2s;
}

.score[data-match-id]:hover {
    background: #667eea;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.seed {
    color: #999;
    font-size: 12px;
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */
@media (max-width: 768px) {
    #bracketContainer {
        padding: 20px 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .bracket {
        gap: 60px;
        padding: 15px 10px;
        overflow-x: visible;
        overflow-y: visible;
        min-width: max-content;
    }
    
    .round {
        min-width: 280px;
        flex-shrink: 0;
    }
    
    .round-label {
        font-size: 14px;
        padding: 10px;
        margin-bottom: 18px;
        white-space: nowrap;
    }
    
    .match {
        min-width: 280px;
        border: 2.5px solid #d0d0d0;
        margin-bottom: 15px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    }
    
    .player {
        padding: 14px 12px;
        min-height: 48px;
        font-size: 14px;
        display: flex;
        align-items: center;
    }
    
    .player-name {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 8px;
    }
    
    .team-names {
        font-size: 14px;
        line-height: 1.4;
        font-weight: 600;
        flex: 1;
        word-break: break-word;
    }
    
    .score {
        font-size: 20px;
        min-width: 40px;
        padding: 4px 10px;
        font-weight: 800;
        background: #e8eef5;
        border-radius: 6px;
    }
    
    .edit-name-btn {
        font-size: 13px;
        padding: 4px 6px;
        opacity: 0.6;
    }
    
    .edit-player1-input,
    .edit-player2-input {
        font-size: 13px;
        padding: 8px 10px;
        min-width: 90px;
    }
    
    /* Make connector lines more visible */
    .bracket-line {
        stroke-width: 3;
        stroke: #999;
    }
    
    /* Better winner highlighting */
    .player.winner {
        background: #e8f5e9;
        border-left: 6px solid #4caf50;
    }
    
    .player.loser {
        opacity: 0.5;
    }
}

@media (max-width: 480px) {
    #bracketContainer {
        padding: 15px 8px;
    }
    
    .bracket {
        gap: 50px;
        padding: 10px 5px;
    }
    
    .round {
        min-width: 260px;
    }
    
    .round-label {
        font-size: 13px;
        padding: 8px;
        margin-bottom: 15px;
    }
    
    .match {
        min-width: 260px;
        border: 2.5px solid #d0d0d0;
        margin-bottom: 12px;
    }
    
    .player {
        padding: 12px 10px;
        min-height: 44px;
        font-size: 13px;
    }
    
    .team-names {
        font-size: 13px;
        line-height: 1.4;
        font-weight: 600;
    }
    
    .score {
        font-size: 18px;
        min-width: 36px;
        padding: 3px 8px;
        font-weight: 800;
    }
    
    .edit-name-btn {
        font-size: 12px;
        padding: 3px 5px;
    }
    
    /* Better touch targets */
    .player.winner {
        border-left: 5px solid #4caf50;
    }
}

/* 3rd Place Match Styling */
.third-place-round {
    min-width: 280px;
}

.third-place-match-box {
    border: 3px solid #cd7f32 !important;
    box-shadow: 0 4px 12px rgba(205, 127, 50, 0.3);
}

.third-place-match-box .player.winner {
    background: linear-gradient(90deg, #fff5e6, #ffffff);
    border-left: 6px solid #cd7f32 !important;
}

@media (max-width: 768px) {
    .third-place-round {
        min-width: 260px;
    }
}

